将openpyxl单元格格式设置为货币 [英] Set openpyxl cell format to currency

查看:423
本文介绍了将openpyxl单元格格式设置为货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用openpyxl创建一个Excel工作表.一些单元格代表货币价值.如何将单元格的格式更改为"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.

推荐答案

尝试设置格式代码与您的所需的格式代码

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

这篇关于将openpyxl单元格格式设置为货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆