Merge pull request #6 from Claustn/master

Added Import-ExcelAllSheet
This commit is contained in:
Doug Finke
2015-04-20 16:00:29 -04:00

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