Merge pull request #1273 from steve-daedilus/master

Set Validate Range for rows to max rows available
This commit is contained in:
Doug Finke
2022-10-20 20:23:05 -04:00
committed by GitHub
3 changed files with 7 additions and 1 deletions

View File

@@ -23,7 +23,7 @@
[Parameter(ParameterSetName = 'PackageC', Mandatory)]
[Switch]$NoHeader ,
[Alias('HeaderRow', 'TopRow')]
[ValidateRange(1, 9999)]
[ValidateRange(1, 1048576)]
[Int]$StartRow = 1,
[Alias('StopRow', 'BottomRow')]
[Int]$EndRow ,

View File

@@ -32,6 +32,12 @@ Describe 'Test' -Tag ImportExcelEndRowAndCols {
$colNames[0] | Should -Be 'Units'
$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' {

Binary file not shown.