mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
29 lines
947 B
PowerShell
29 lines
947 B
PowerShell
function Export-MultipleExcelSheets {
|
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")]
|
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="No suitable singular")]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
$Path,
|
|
[Parameter(Mandatory = $true)]
|
|
[hashtable]$InfoMap,
|
|
[string]$Password,
|
|
[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 }
|
|
}
|