Add switch to not return data as a dictionary

This commit is contained in:
dfinke
2022-04-12 18:03:34 -04:00
parent d55f0e64d4
commit 483f761016
2 changed files with 20 additions and 3 deletions

View File

@@ -36,7 +36,8 @@
[string[]]$AsDate,
[ValidateNotNullOrEmpty()]
[String]$Password,
[Int[]]$ImportColumns
[Int[]]$ImportColumns,
[Switch]$NoHashtable
)
end {
$sw = [System.Diagnostics.Stopwatch]::StartNew()
@@ -234,7 +235,12 @@
finally {
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
if ($Worksheet.Count -eq 1) {
if ($NoHashtable) {
foreach ($entry in $xlbook.GetEnumerator()) {
$entry.Value
}
}
elseif ($Worksheet.Count -eq 1) {
$xlBook["$targetSheetname"]
}
else {