mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-27 21:53:18 +00:00
Compare commits
4 Commits
copilot/fi
...
Fix-Import
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebdfd3d090 | ||
|
|
a1986de292 | ||
|
|
30f2597f0d | ||
|
|
09c22654ab |
@@ -235,8 +235,14 @@
|
|||||||
# Write-Verbose "Import cell '$($Worksheet.Cells[$R, $P.Column].Address)' with property name '$($p.Value)' and value '$($Worksheet.Cells[$R, $P.Column].Value)'."
|
# Write-Verbose "Import cell '$($Worksheet.Cells[$R, $P.Column].Address)' with property name '$($p.Value)' and value '$($Worksheet.Cells[$R, $P.Column].Value)'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($WorksheetName -eq '*') {
|
||||||
$xlBook["$targetSheetname"] += [PSCustomObject]$NewRow
|
$xlBook["$targetSheetname"] += [PSCustomObject]$NewRow
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
[PSCustomObject]$NewRow
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,6 +253,8 @@
|
|||||||
# $EndColumn = 0
|
# $EndColumn = 0
|
||||||
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
|
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
|
||||||
|
|
||||||
|
if ($WorksheetName -eq '*') {
|
||||||
|
|
||||||
if ($Raw) {
|
if ($Raw) {
|
||||||
foreach ($entry in $xlbook.GetEnumerator()) {
|
foreach ($entry in $xlbook.GetEnumerator()) {
|
||||||
$entry.Value
|
$entry.Value
|
||||||
@@ -262,3 +270,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
12
__tests__/ImportExcelTests/ImportExcelTiming.tests.ps1
Normal file
12
__tests__/ImportExcelTests/ImportExcelTiming.tests.ps1
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
__tests__/ImportExcelTests/TimingRows20k.xlsx
Normal file
BIN
__tests__/ImportExcelTests/TimingRows20k.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user