Set openpyxl cell format to currency

Dominic picture Dominic · Jan 7, 2016 · Viewed 14.6k times · Source

I'm creating an excel sheet using openpyxl. Some cells represent monetary values. How can I change the format of a cell to be of type "currency", i.e. I want a "€" symbol to be displayed after the number.

Answer

absolutelyNoWarranty picture absolutelyNoWarranty · Jan 7, 2016

Try setting the format code with your desired format code

_cell.number_format = '#,##0.00€'