Added Export-MultipleExcelSheets

This commit is contained in:
Doug Finke
2015-04-10 10:02:33 -04:00
parent 90d4379a21
commit e6c8380c58
2 changed files with 37 additions and 1 deletions

View File

@@ -143,4 +143,30 @@ function Export-Excel {
if($Show) {Invoke-Item $Path}
}
}
}
function Export-MultipleExcelSheets {
param(
[Parameter(Mandatory)]
$Path,
[Parameter(Mandatory)]
[hashtable]$InfoMap,
[Switch]$Show,
[Switch]$AutoSize
)
$parameters = @{}+$PSBoundParameters
$parameters.Remove("InfoMap")
$parameters.Remove("Show")
$parameters.Path = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path)
foreach ($entry in $InfoMap.GetEnumerator()) {
Write-Progress -Activity "Exporting" -Status "$($entry.Key)"
$parameters.WorkSheetname=$entry.Key
& $entry.Value | Export-Excel @parameters
}
if($Show) {Invoke-Item $Path}
}