GetConditionalFormatting.ps1 example added: exports conditional formatting rules in a 'ready to use' format

This commit is contained in:
Kinga Kazala
2022-07-05 16:05:40 +02:00
parent 9051ffc0e5
commit c4eed8c25d

View File

@@ -0,0 +1,10 @@
try { Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 } catch { throw ; return}
$xlSourcefile = "$env:TEMP\ImportExcelExample.xlsx"
$excel = Open-ExcelPackage -Path $xlSourcefile
$excel.Workbook.Worksheets | ForEach-Object {
$_.ConditionalFormatting | ForEach-Object {
Write-Host "Add-ConditionalFormatting -Worksheet `$excel[""$worksheetName""] -Range '$($_.Address)' -ConditionValue '$($_.Formula)' -RuleType $($_.Type) "
}
}