mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-10 13:23:29 +00:00
GetConditionalFormatting.ps1 example added: exports conditional formatting rules in a 'ready to use' format
This commit is contained in:
10
Examples/ConditionalFormatting/GetConditionalFormatting.ps1
Normal file
10
Examples/ConditionalFormatting/GetConditionalFormatting.ps1
Normal 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) "
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user