Feb-24-2020, 06:19 AM
I was using following conditional formatting code but it is not working :
Thanks in advance
#Data_analysis_std is excel file name #pd is pandas object writer = pd.ExcelWriter('Data_Analysis_Std.xlsx', engine ='openpyxl') wb = writer.book ws = writer.sheets['Sheet1'] red_background = PatternFill(bgColor=colors.RED) diff_style = DifferentialStyle(fill=red_background) rule = Rule(type="uniqueValues", dxf=diff_style) #ws.conditional_formatting.add({2, previous_date_data_column, 2 ,current_date_data_column} ,rule) ws.conditional_formatting.add('B:I' ,rule)Above code "ws.conditional_formatting.add('B:I' ,rule)" is showing error because of range as i want to compare 2 columns that is column B and column I but here i am defining range, but i don't understand what is correct format. Or there is anyother way to compare two column please let me know
Error:TypeError: expected <class 'openpyxl.worksheet.cell_range.MultiCellRange'>
If any other information required please let me know.Thanks in advance