问题
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