mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-12 06:13:26 +00:00
Compare commits
10 Commits
v7.8.2
...
Fix-Import
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebdfd3d090 | ||
|
|
a1986de292 | ||
|
|
30f2597f0d | ||
|
|
09c22654ab | ||
|
|
63f6543784 | ||
|
|
306e10c348 | ||
|
|
970febd6d3 | ||
|
|
e703a21dec | ||
|
|
c1be6a8d82 | ||
|
|
4bd3efa1ef |
@@ -23,7 +23,7 @@
|
|||||||
[Parameter(ParameterSetName = 'PackageC', Mandatory)]
|
[Parameter(ParameterSetName = 'PackageC', Mandatory)]
|
||||||
[Switch]$NoHeader ,
|
[Switch]$NoHeader ,
|
||||||
[Alias('HeaderRow', 'TopRow')]
|
[Alias('HeaderRow', 'TopRow')]
|
||||||
[ValidateRange(1, 9999)]
|
[ValidateRange(1, 1048576)]
|
||||||
[Int]$StartRow = 1,
|
[Int]$StartRow = 1,
|
||||||
[Alias('StopRow', 'BottomRow')]
|
[Alias('StopRow', 'BottomRow')]
|
||||||
[Int]$EndRow ,
|
[Int]$EndRow ,
|
||||||
@@ -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)'."
|
# 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
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -247,16 +253,19 @@
|
|||||||
# $EndColumn = 0
|
# $EndColumn = 0
|
||||||
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
|
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
|
||||||
|
|
||||||
if ($Raw) {
|
if ($WorksheetName -eq '*') {
|
||||||
foreach ($entry in $xlbook.GetEnumerator()) {
|
|
||||||
$entry.Value
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ Describe 'Test' -Tag ImportExcelEndRowAndCols {
|
|||||||
$colNames[0] | Should -Be 'Units'
|
$colNames[0] | Should -Be 'Units'
|
||||||
$colNames[1] | Should -Be 'Price'
|
$colNames[1] | Should -Be 'Price'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
It 'Should read any row up to maximum allowed row' {
|
||||||
|
$xlMaxRows = "$PSScriptRoot\MaxRows.xlsx"
|
||||||
|
$actual = Import-Excel $xlMaxRows -StartRow 1048576 -EndRow 1048576 -NoHeader
|
||||||
|
$actual.P1 | Should -Be 1048576
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context 'Test reading multiple sheets with data in differnt rows and columns' {
|
Context 'Test reading multiple sheets with data in differnt rows and columns' {
|
||||||
|
|||||||
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/MaxRows.xlsx
Normal file
BIN
__tests__/ImportExcelTests/MaxRows.xlsx
Normal file
Binary file not shown.
BIN
__tests__/ImportExcelTests/TimingRows20k.xlsx
Normal file
BIN
__tests__/ImportExcelTests/TimingRows20k.xlsx
Normal file
Binary file not shown.
@@ -3,6 +3,7 @@
|
|||||||
- Fix docs [#1254](https://github.com/dfinke/ImportExcel/pull/1251)`Add-Worksheet` warning. Thank you [Wilson Stewart](https://github.com/WilsonStewart)
|
- Fix docs [#1254](https://github.com/dfinke/ImportExcel/pull/1251)`Add-Worksheet` warning. Thank you [Wilson Stewart](https://github.com/WilsonStewart)
|
||||||
- Fix docs [#1251](https://github.com/dfinke/ImportExcel/pull/1251)`Add-Worksheet` warning. Thank you [Jeremiah Adams](https://github.com/JeremiahTheFirst)
|
- Fix docs [#1251](https://github.com/dfinke/ImportExcel/pull/1251)`Add-Worksheet` warning. Thank you [Jeremiah Adams](https://github.com/JeremiahTheFirst)
|
||||||
- Fix docs [#1253](https://github.com/dfinke/ImportExcel/pull/1253) `convertfrom-exceltosqlinsert`. Thank you [Wes Stahler](https://github.com/stahler)
|
- Fix docs [#1253](https://github.com/dfinke/ImportExcel/pull/1253) `convertfrom-exceltosqlinsert`. Thank you [Wes Stahler](https://github.com/stahler)
|
||||||
|
- Set Validate Range for rows to max rows available [#1273](https://github.com/dfinke/ImportExcel/pull/1273). Thank you [Stephen Brown](https://github.com/steve-daedilus)
|
||||||
- Extended Get-ExcelFileSummary to include more Visible -eq $true|$false
|
- Extended Get-ExcelFileSummary to include more Visible -eq $true|$false
|
||||||
|
|
||||||
# 7.8.1
|
# 7.8.1
|
||||||
|
|||||||
Reference in New Issue
Block a user