Format column as percentage in Openpyxl Python

假装没事ソ 提交于 2019-12-24 06:38:52

问题


I just want to make certain columns into percentages using Openpyxl for Python. I can't figure out how to change the formatting of the cells to another type?

I've consulted this page:

http://openpyxl.readthedocs.io/en/default/styles.html

But if I try doing:

ws['A:A'].style = percent

I get ValueError: Style percent exists already. I'm sure I'm making some stupid mistake, but I can't figure out what it is. I've seen other threads about people wanting to change formats to currencies, which uses a different number formatting, but nothing about percentages.


回答1:


You can only format individual cells not cell ranges or columns or rows.



来源:https://stackoverflow.com/questions/44849036/format-column-as-percentage-in-openpyxl-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!