简体   繁体   English

将 openpyxl 单元格格式设置为货币

[英]Set openpyxl cell format to currency

I'm creating an excel sheet using openpyxl.我正在使用 openpyxl 创建一个 excel 表。 Some cells represent monetary values.一些单元格代表货币价值。 How can I change the format of a cell to be of type "currency", ie I want a "€" symbol to be displayed after the number.如何将单元格的格式更改为“货币”类型,即我希望在数字后显示“€”符号。

Try setting the format code with your desired format code尝试使用您想要的格式代码设置格式代码

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM