Fixed 'DataOnly' header issue

This has been fixed: Looks like it adds the "headers" in the sheet to
the data when you specify -DataOnly
This commit is contained in:
DarkLite1
2017-02-14 09:38:08 +01:00
parent 7cdf40e0c8
commit e68a5f27e5

View File

@@ -128,7 +128,8 @@ function Import-Excel {
[PSCustomObject]$newRow
}
}
} else {
}
else {
if (!$Header) {
$Header = foreach ($Column in 1..$Columns) {
$worksheet.Cells[$HeaderRow,$Column].Value
@@ -140,7 +141,7 @@ function Import-Excel {
}
else {
if ($DataOnly) {
$CellsWithValues = $worksheet.Cells | where Value
$CellsWithValues = $worksheet.Cells | where {$_.Value -and ($_.End.Row -ne 1)}
$Script:i = -1
$ColumnReference = $CellsWithValues | Select-Object -ExpandProperty End | Group-Object Column |