Added Import-ExcelAllSheet

Export all sheets
This commit is contained in:
Claustn
2015-04-18 22:02:03 +02:00
parent bb707195af
commit e3159023c6

View File

@@ -43,6 +43,39 @@ function Import-Excel {
}
}
function Import-ExcelAllSheet
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[String]
$Path,
[String]
$OutputPath = '.\',
[string]
$Encoding = 'UTF8',
[string]
$Extension = '.txt',
[string]
$Delimiter = ';'
)
$FullName = (Resolve-Path $Path).Path
$xl = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $FullName
$workbook = $xl.Workbook
Foreach ($sheet in $workbook.Worksheets)
{
Write-Verbose "Exporting sheet: $($sheet.name)"
Import-Excel -FullName $FullName -Sheet $($sheet.Name) | Export-Csv -Path "$($OutputPath)\$($Sheet.Name)$($Extension)" -Delimiter $Delimiter -NoTypeInformation -Encoding $Encoding
}
}
function Export-Excel {
<#
.Synopsis