I am creating an excel report using pandas xlswriter module. Below the code-snippet for the same.
number_rows = len(df.index)
//df is dataframe
writer = pd.ExcelWriter("Report_1.xlsx",engine='xlsxwriter')
df.to_excel(writer,"report")
workbook = writer.book
worksheet = writer.sheets['report']
# Define range for the color formatting
color_range = "A2:F{}".format(number_rows+1)
format1 = workbook.add_format({'bg_color': '#FFC7CE',
'font_color': '#9C0006'})
worksheet.conditional_format(color_range, {'type': 'text',
'criteria' : 'containing',
'value': 'SUCCESS',
'format': format1})
I want to highlight a row ('bg_color': '#FFC7CE', 'font_color': '#9C0006') based on a cell value(=SUCCESS). But when I use the "conditional_format" it is applying only on that particular cell. Is there any way to apply the format to the entire row if the “criteria” matches cell value?