Dante Arcese
Dante Arcese

Reputation: 91

Trouble using a "builtin" style in openpyxl

I am having trouble using a builtin style in openpyxl. I am able to change the font and other attributes of a cell by doing something such as:

cell.font = openpyxl.styles.Font(size=10)

but am lost when it comes to builtin styles such as accents and number formatting. I have tried the following line of code:

cell.style = openpyxl.styles.builtins.currency

but this results in the following error:

File "C:\Python27\lib\site-packages\openpyxl\styles\styleable.py", line 81, in __set__
raise ValueError("{0} is not a known style".format(value))

Any help is appreciated.

Upvotes: 0

Views: 2083

Answers (1)

Dante Arcese
Dante Arcese

Reputation: 91

Looks like I was overthinking things. All that needed to be done was the following:

cell.style = 'Currency'

Upvotes: 2

Related Questions