I'm trying to color cells within Column J
a yellow color where it's cell value is N
.
I'm able to achieve this but I also want to color the corresponding cells in columns H
& I
when Column J
is N
and am having difficulty doing so.
Does anyone have suggestions on how I can implement this?
This is my code so far:
import pandas as pd
filePath = r"C:\\Users\\Desktop\\Match\\"
parameters = 'Transactions.xlsx'
df = pd.read_excel(filePath + parameters,usecols="A:EN")
with pd.ExcelWriter(r"C:\\Users\\Desktop\\Match\\Compare_Matches.xlsx",
engine='xlsxwriter') as writer:
workbook = writer.book
df.to_excel(writer)
worksheet = workbook.worksheets()[0]
format_yellow = workbook.add_format({'bg_color': '#FFFF00'})
worksheet.conditional_format('J1:J13630',
{'type': 'text',
'criteria': 'containing',
'value': 'N',
'format': format_yellow,})