Imagine we have a dataframe that we save in an excel. Let's assume it is the following
A B C
Alex Low Paris
Helen High London
Maria Mid New York
I want to color the complete row if in B column
- the value is 'Low' OR
- the value is 'Mid'
using openpyxl. I tried the following
for cell in ws['B']:
if cell.value == 'Low' or cell.value == 'Mid':
cell.fill = pxl.styles.PatternFill("solid", fgColor=grey)
where ws is created from a Workbook() sheet
The issue is that it only greys the background of that specific cell. How can I grey out the rest of the rows?