I was generating xlxs file from python python xlxswriter package. I want to generate rows with color coded based on the combination unique id. Please find the below output
Current Logic:
fontcolor_indexlist = [data[0] for data in df_Index.select("index").filter(col("Invoice Calculation Date") == f'{InvoiceDate}').collect()] #Getting index from pyspark dataframe
pandas_df = df_InvoiceDetails.drop("cellformat").toPandas()
writer = pd.ExcelWriter(f"/tmp/{DetailsFileName}", engine="xlsxwriter")
cell_format = workbook.add_format({'valign': 'vcenter', 'align': 'center','fg_color': '#D3D3D3'})
if row_num in fontcolor_indexlist:
worksheet.write(row_num, col_num, value, cell_format)
I tried the above code and wants to achieve the xlxs file with low code, similar to conditional formatting

Assuming you want to alternate the color of each
"id"/block, I would usegroupby/write_row:Used input :