Compare commits

...

4 Commits

Author SHA1 Message Date
dfinke
ebdfd3d090 process only if the worksheetname is '*' for all 2022-11-07 12:37:28 -05:00
dfinke
a1986de292 update filename and check count returned 2022-11-07 12:36:59 -05:00
dfinke
30f2597f0d rename xlsx 2022-11-07 12:36:47 -05:00
dfinke
09c22654ab Initial timing tests. 7.4.2 is the benchmark 7.4.2 vs newer versions processing time #1299 2022-11-06 15:28:11 -05:00
3 changed files with 31 additions and 10 deletions

View File

@@ -235,7 +235,13 @@
# Write-Verbose "Import cell '$($Worksheet.Cells[$R, $P.Column].Address)' with property name '$($p.Value)' and value '$($Worksheet.Cells[$R, $P.Column].Value)'."
}
}
$xlBook["$targetSheetname"] += [PSCustomObject]$NewRow
if ($WorksheetName -eq '*') {
$xlBook["$targetSheetname"] += [PSCustomObject]$NewRow
}
else {
[PSCustomObject]$NewRow
}
}
#endregion
}
@@ -247,16 +253,19 @@
# $EndColumn = 0
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
if ($Raw) {
foreach ($entry in $xlbook.GetEnumerator()) {
$entry.Value
if ($WorksheetName -eq '*') {
if ($Raw) {
foreach ($entry in $xlbook.GetEnumerator()) {
$entry.Value
}
}
elseif ($Worksheet.Count -eq 1) {
$xlBook["$targetSheetname"]
}
else {
$xlBook
}
}
elseif ($Worksheet.Count -eq 1) {
$xlBook["$targetSheetname"]
}
else {
$xlBook
}
}
}

View File

@@ -0,0 +1,12 @@
Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
Describe "Tests Import-Excel Timings" -Tag Timing {
It "Should read the 20k xlsx in -le 2100 milliseconds" {
$timer = Measure-Command {
$data = Import-Excel $PSScriptRoot\TimingRows20k.xlsx
}
$timer.TotalMilliseconds | Should -BeLessOrEqual 2100
$data.Count | Should -Be 19999
}
}

Binary file not shown.