Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set openpyxl cell format to currency

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.

like image 346
Dominic Avatar asked Jan 07 '16 10:01

Dominic


People also ask

How do I style a cell in Openpyxl?

To change a style property of a cell, first you either have to copy the existing style object from the cell and change the value of the property or you have to create a new style object with the desired settings. Then, assign the new style object to the cell.


1 Answers

Try setting the format code with your desired format code

_cell.number_format = '#,##0.00€' 
like image 137
absolutelyNoWarranty Avatar answered Oct 06 '22 14:10

absolutelyNoWarranty