mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-12 14:23:14 +00:00
Add -NoHeader to Export-Excel
This commit is contained in:
@@ -37,6 +37,7 @@ function Export-Excel {
|
|||||||
[Switch]$FreezeTopRow,
|
[Switch]$FreezeTopRow,
|
||||||
[Switch]$AutoFilter,
|
[Switch]$AutoFilter,
|
||||||
[Switch]$BoldTopRow,
|
[Switch]$BoldTopRow,
|
||||||
|
[Switch]$NoHeader,
|
||||||
[string]$RangeName,
|
[string]$RangeName,
|
||||||
[string]$TableName,
|
[string]$TableName,
|
||||||
[Object[]]$ConditionalFormat,
|
[Object[]]$ConditionalFormat,
|
||||||
@@ -58,6 +59,7 @@ function Export-Excel {
|
|||||||
$rule = ($ws.ConditionalFormatting).$target($format.Address, $format.IconType)
|
$rule = ($ws.ConditionalFormatting).$target($format.Address, $format.IconType)
|
||||||
$rule.Reverse = $format.Reverse
|
$rule.Reverse = $format.Reverse
|
||||||
}
|
}
|
||||||
|
|
||||||
# Force at least one cell value
|
# Force at least one cell value
|
||||||
$ws.Cells[1, 1].Value = ""
|
$ws.Cells[1, 1].Value = ""
|
||||||
|
|
||||||
@@ -120,9 +122,14 @@ function Export-Excel {
|
|||||||
$ColumnIndex = 1
|
$ColumnIndex = 1
|
||||||
$Header = $TargetData.psobject.properties.name
|
$Header = $TargetData.psobject.properties.name
|
||||||
|
|
||||||
foreach ($Name in $Header) {
|
if($NoHeader) {
|
||||||
$ws.Cells[$Row, $ColumnIndex].Value = $name
|
# Don't push the headers to the spread sheet
|
||||||
$ColumnIndex += 1
|
$Row -= 1
|
||||||
|
} else {
|
||||||
|
foreach ($Name in $Header) {
|
||||||
|
$ws.Cells[$Row, $ColumnIndex].Value = $name
|
||||||
|
$ColumnIndex += 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user