Andrea Gavana wrote:
>
>     I was wondering if someone had already tackled the problem of
> converting Excel cell NumberFormat to something Python can parse and
> actually use. In more detail, what I mean is: once you right-click on
> a cell and select "Format Cells" you get a huge list of possible
> formatting options, divided into categories. I don't think I will have
> any particular problem in interpreting and coding in Python what the
> following NumberFormats mean:
>
> - "0.00"
> - "%0.0"
> - "General"
> - "Text"
>
> But some of them are a bit obscure and problematic to me (in the
> "Custom" section):
>
> - "_($* #,##0_);_($* (#,##0);_($* "-"_);"
> - "[$€-2] #,##0.00_);[Red]([$€-2] #,##0.00)"

Yes, those are challenging.  I can tell you what they mean, but that
won't make them easier to parse.

When there are two parts separated by a semi-colon ";", the left part is
used for numbers >= 0, the right part for < 0.  When there are three
parts separated by a semi-colon, part one is > 0, part two is < 0, part
three is == 0.

[$€-2] is a variation of $.  $ by itself says "always put a dollar
sign".  [$€-2] says "the currency symbol is euro code #2", which is the
stock euro on the left.  There are a bunch of euro variations.

Definitely a non-trivial chore to translate this.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to