mirror of
https://github.com/dfinke/ImportExcel.git
synced 2026-01-01 08:03:27 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79e5bdf8ba | ||
|
|
b03d9b048a | ||
|
|
aea90aa8d6 | ||
|
|
d4ebc9e95d |
@@ -2,6 +2,6 @@ Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
|
||||
|
||||
$xlfile = "$PSScriptRoot\yearlySales.xlsx"
|
||||
|
||||
$result = Import-Excel $xlfile * -NotAsDictionary
|
||||
$result = Import-Excel -Path $xlfile -WorksheetName * -NotAsDictionary
|
||||
|
||||
$result | Measure-Object
|
||||
@@ -2,7 +2,7 @@ Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
|
||||
|
||||
$xlfile = "$PSScriptRoot\yearlySales.xlsx"
|
||||
|
||||
$result = Import-Excel $xlfile *
|
||||
$result = Import-Excel -Path $xlfile -WorksheetName *
|
||||
|
||||
foreach ($sheet in $result.Values) {
|
||||
$sheet
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
RootModule = 'ImportExcel.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '7.5.0'
|
||||
ModuleVersion = '7.5.1'
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = '60dd4136-feff-401a-ba27-a84458c57ede'
|
||||
|
||||
@@ -134,6 +134,8 @@
|
||||
|
||||
$xlBook = [Ordered]@{}
|
||||
foreach ($sheet in $Worksheet) {
|
||||
$EndRow = 0
|
||||
$EndColumn = 0
|
||||
$targetSheetname = $sheet.Name
|
||||
$xlBook["$targetSheetname"] = @()
|
||||
#region Get rows and columns
|
||||
@@ -233,8 +235,8 @@
|
||||
}
|
||||
catch { throw "Failed importing the Excel workbook '$Path' with worksheet '$WorksheetName': $_"; return }
|
||||
finally {
|
||||
$EndRow = 0
|
||||
$EndColumn = 0
|
||||
# $EndRow = 0
|
||||
# $EndColumn = 0
|
||||
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
|
||||
|
||||
if ($NotAsDictionary) {
|
||||
|
||||
@@ -59,5 +59,15 @@ Describe 'Different ways to import sheets' -Tag ImportExcelReadSheets {
|
||||
$group[0].Name | Should -BeExactly 'April'
|
||||
$group[1].Name | Should -BeExactly 'June'
|
||||
}
|
||||
|
||||
It "Should read multiple sheets with diff number of rows correctly" {
|
||||
$xlFilename = "$PSScriptRoot\construction.xlsx"
|
||||
|
||||
$actual = Import-Excel $xlFilename 2015, 2016
|
||||
$actual.keys.Count | Should -Be 2
|
||||
|
||||
$actual["2015"].Count | Should -Be 12
|
||||
$actual["2016"].Count | Should -Be 1
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
__tests__/ImportExcelTests/construction.xlsx
Normal file
BIN
__tests__/ImportExcelTests/construction.xlsx
Normal file
Binary file not shown.
@@ -1,3 +1,5 @@
|
||||
# v7.5.1
|
||||
- Fixed `Import-Excel` - Reset `EndRow` and `EndColumn` in the correct place.
|
||||
# v7.5.0
|
||||
## Fixes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user