from ironxl import * # Load existing spreadsheet workbook = WorkBook.Load("sample.xlsx") worksheet = workbook.DefaultWorkSheet # Create conditional formatting rule rule = worksheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "8") # Set style options rule.FontFormatting.IsBold = True rule.FontFormatting.FontColor = "#123456" rule.BorderFormatting.RightBorderColor = "#ffffff" rule.BorderFormatting.RightBorderType = BorderType.Thick rule.PatternFormatting.BackgroundColor = "#54bdd9" rule.PatternFormatting.FillPattern = FillPattern.Diamonds # Apply formatting on the specified region worksheet.ConditionalFormatting.AddConditionalFormatting("A3:A8", rule) # Create another conditional formatting rule rule1 = worksheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.Between, "7", "10") # Set style options rule1.FontFormatting.IsItalic = True rule1.FontFormatting.UnderlineType = FontUnderlineType.Single # Apply formatting on the specified region worksheet.ConditionalFormatting.AddConditionalFormatting("A3:A9", rule1) # Save changes with applied conditional formatting workbook.SaveAs("applyConditionalFormatting.xlsx")