mirror of
https://github.com/dfinke/ImportExcel.git
synced 2026-01-04 17:43:48 +00:00
Fixes #68 Import-Excel headers no data
This commit is contained in:
@@ -80,15 +80,19 @@ function Import-Excel {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($Row in ($HeaderRow+1)..$Rows) {
|
||||
$h=[Ordered]@{}
|
||||
foreach ($Column in 0..($Columns-1)) {
|
||||
if($Header[$Column].Length -gt 0) {
|
||||
$Name = $Header[$Column]
|
||||
$h.$Name = $worksheet.Cells[$Row,($Column+1)].Value
|
||||
if($Rows -eq 1) {
|
||||
$Header | ForEach {$h=[Ordered]@{}} {$h.$_=''} {[PSCustomObject]$h}
|
||||
} else {
|
||||
foreach ($Row in ($HeaderRow+1)..$Rows) {
|
||||
$h=[Ordered]@{}
|
||||
foreach ($Column in 0..($Columns-1)) {
|
||||
if($Header[$Column].Length -gt 0) {
|
||||
$Name = $Header[$Column]
|
||||
$h.$Name = $worksheet.Cells[$Row,($Column+1)].Value
|
||||
}
|
||||
}
|
||||
[PSCustomObject]$h
|
||||
}
|
||||
[PSCustomObject]$h
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user