Skip to content Skip to sidebar Skip to footer

Openpyxl - Checking If Cell Has Fill

I am trying to check if a cell is highlighted in yellow. All the posts I've come across is to fill a cell, not check if it has a fill. Heres my code so far: coordinates = [] fl

Solution 1:

Try this:

if (d.font.color):
    #it's highlighted

Or there is another option:

d.fill.start_color.index

Hope this helps.

Post a Comment for "Openpyxl - Checking If Cell Has Fill"