i have this line to set the background color of a cell but instead of the color i specified it set the cell to black.

Tried with diferent colors to check and it always set it to black.

why is that and how to fix it?

ws['A1'].fill = PatternFill(fgColor="7FFFD4", fill_type="solid")
ws['A1'].fill = PatternFill(start_color="8a2be2", end_color="8a2be2", fill_type="solid")
ws['A1'].fill = PatternFill(start_color="8a2be2", fill_type="solid")
ws['A1'].fill = PatternFill(bgColor="7FFFD4", fill_type="solid")

Recommended Answers

All 2 Replies

Same comment as your other related post. If I posted

x = splunge.fnord(1,2,'abc')

and asked why it doesn't work, your first comment would likely be, "I have no idea what splunge and fnord are".

iv got it with

xlsx['Sheet']['A1'].fill = PatternFill(start_color='FF001F', end_color='FF001F',fill_type = 'solid')
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.