Set openpyxl cell format to currency
18,748
Try setting the format code with your desired format code
_cell.number_format = '#,##0.00€'
Comments
-
Dominic almost 2 years
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.
-
Dominic over 8 yearsyour code didn't work for me out of the box, but it guided me to the solution.
_cell.number_format = '#,##0.00€'
did the trick. Thank you! -
Charlie Clark over 8 yearsThat was the older API. We changed in recent versions to make it simpler to use.
-
Gigino over 3 years@Dominic where exactly is the difference between your code and the accepted answer?
-
Mare Seestern over 2 years@Gigino There is no difference. There was a difference before the edit.