Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Cell Formats with xlwt format strings

I've looked around for several different xlwt formats for cells, but I can't find a comprehensive list. Excel provides the following options for cell content formatting: (general, number, currency, accounting, date, time, percentage, fraction, scientific, text, special, custom) Obviously custom isn't what I want, but what are the formatting strings for all these different options? For example, I've seen:

date_format = XFStyle()
date_format.num_format_str = 'dd/mm/yyyy'

currency_format = XFStyle()
currency_format.num_format_str = '$#,##0.00'

Is there somewhere I can get a comprehensive list of those formatting strings? The documentation on http://www.python-excel.org/ doesn't have much, and the tutorial at the bottom only seems to have dates.

like image 544
user2569332 Avatar asked Jul 26 '13 17:07

user2569332


1 Answers

I've found a list. I was just being stupid about looking for it.
The GitHub project has a list of number format strings here:
https://github.com/python-excel/xlwt/blob/master/examples/num_formats.py

like image 102
user2569332 Avatar answered Sep 22 '22 11:09

user2569332