Preformat for currency and two decimal places in python using xlwt for excel

I have the column header Fee . Using xlwt in python , I successfully generated the required excel. This column is always empty when creating the Excel file.

Is it possible for the Fee column to be pre-formatted in "Currency" and "Two decimal places", so when I manually write in the Fee column of the Excel file after loading, 23 should change to $ 23.00 ?

+5
source share
1 answer

I started working like this:

currency_style = xlwt.XFStyle()

currency_style.num_format_str = "[$$-409]#,##0.00;-[$$-409]#,##0.00"

sheet.write(row+2, col, val, style=currency_style)

+8
source

All Articles