Fix null header

This commit is contained in:
Doug Finke
2015-05-25 14:37:00 -04:00
parent 9f40401c78
commit 7e112b1e2c
4 changed files with 9 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
RootModule = 'ImportExcel.psm1' RootModule = 'ImportExcel.psm1'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.2' ModuleVersion = '1.3'
# ID used to uniquely identify this module # ID used to uniquely identify this module
GUID = '60dd4136-feff-401a-ba27-a84458c57ede' GUID = '60dd4136-feff-401a-ba27-a84458c57ede'

View File

@@ -32,8 +32,10 @@ function Import-Excel {
foreach ($Row in 2..$Rows) { foreach ($Row in 2..$Rows) {
$h=[Ordered]@{} $h=[Ordered]@{}
foreach ($Column in 0..($Columns-1)) { foreach ($Column in 0..($Columns-1)) {
$Name = $Header[$Column] if($Header[$Column].Length -gt 0) {
$h.$Name = $worksheet.Cells[$Row,($Column+1)].Text $Name = $Header[$Column]
$h.$Name = $worksheet.Cells[$Row,($Column+1)].Text
}
} }
[PSCustomObject]$h [PSCustomObject]$h
} }

View File

@@ -4,7 +4,7 @@ $p = @{
NuGetApiKey = $NuGetApiKey NuGetApiKey = $NuGetApiKey
LicenseUri = "https://github.com/dfinke/ImportExcel/blob/master/LICENSE.txt" LicenseUri = "https://github.com/dfinke/ImportExcel/blob/master/LICENSE.txt"
Tag = "Excel","EPPlus","Export","Import" Tag = "Excel","EPPlus","Export","Import"
ReleaseNote = "Rename parameter BoldFirstRow to BoldTopRow" ReleaseNote = "Fixed null header"
ProjectUri = "https://github.com/dfinke/ImportExcel" ProjectUri = "https://github.com/dfinke/ImportExcel"
} }

View File

@@ -23,6 +23,9 @@ Know Issues
What's new What's new
- -
#### 5/25/2015
* Fixed null header problem
#### 5/17/2015 #### 5/17/2015
* Added three parameters: * Added three parameters:
* FreezeTopRow - Freezes the first row of the data * FreezeTopRow - Freezes the first row of the data