ImportExcel
ImportExcel copied to clipboard
Conditional Formatting
Loving this module. Have just starting looking into conditional formatting. I have successfully applied conditional formatting to a cell in column L if it has a value of NO. How can I apply that formatting to the entire row? I know I can add the range, but that will look for the value in the entire range. I only want the row highlighted if column L is NO.
Sorry, missed this.
$data = ConvertFrom-Csv @"
Region,State,Units,Price
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
East,Maine,828,661.24
West,Virginia,465,053.58
North,Missouri,436,235.67
South,Kansas,214,992.47
North,North Dakota,789,640.72
South,Delaware,712,508.55
"@
$xlfile = 'test.xlsx'
Remove-Item $xlfile -ErrorAction SilentlyContinue
$excel = $data | Export-Excel $xlfile -AutoSize -PassThru
Add-ConditionalFormatting -Worksheet $excel.sheet1 -Range "A2:D10" -ConditionValue '=$A2="North"' -RuleType Expression -BackgroundColor LightGreen
Close-ExcelPackage $excel -Show
