I use openpyxl to create an xlsx file. The contents of the cells are variable depending on certain conditions and each content is associated with a background color.
To avoid having to write so many "font-colors" I thought I’d do something like this:
site_color = color of the condition
cellfont = Font(name='Arial', size=8, bold=False, italic=False, color = %s)%(site_color)
but I get two errors:
"(" was not closed
Expected expression
>Solution :
Solution:
Set your color parameter directly equal to your site_color.
cellfont = Font(name='Arial', size=8, bold=False, italic=False, color = site_color)