I have two columns in a dataframe named FirstName and LastName.
I need to make the font color of any cell's text in the FirstName column red if any cell in the LastName is not blank.
writer = pd.ExcelWriter(fileName, engine='xlsxwriter')
df.to_excel(writer,'Sheet1', index_label=None, index=False)
workbook = writer.book
redFont = workbook.add_format({'font_color': '#9C0006'})
worksheet = writer.sheets['Sheet1']
worksheet.conditional_format(1, 0, 9999999, 0,
{'type': 'formula',
'criteria': '=ISBLANK($B1)',
'format': redFont})
writer.save()
I do not get errors but the font color does not change. I can not figure out what I am doing wrong. Any ideas?
Thank you!