I am currently using openpyxl v2.2.2 for Python 2.7 and i wanted to set colors to cells. I have used the following imports
from openpyxl import Workbook
from openpyxl.styles import Color, PatternFill, Font, Border
from openpyxl.styles import colors
from openpyxl.cell import Cell
wb = openpyxl.Workbook()
ws = wb.active
redFill = PatternFill(start_color='FFFF0000',
ws['A1'].style = redFill
Traceback (most recent call last)
self.font = value.font.copy()
AttributeError: 'PatternFill' object has no attribute 'font'
Why are you trying to assign a fill to a style?
ws['A1'].fill = redFill should work fine.