Add and test new HeaderName parameter

This commit is contained in:
dfinke
2022-09-09 19:03:06 -04:00
parent 4c002358fe
commit b61aef888f
2 changed files with 94 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
[Switch]$Calculate,
[Switch]$Show,
[String]$WorksheetName = 'Sheet1',
[String]$HeaderName,
[Alias("PW")]
[String]$Password,
[switch]$ClearSheet,
@@ -258,6 +259,11 @@
try {
if ($null -eq $InputObject) { $row += 1 }
foreach ($TargetData in $InputObject) {
if ($HeaderName -and $TargetData.psobject.TypeNames[0] -match 'System.String|System.Int32|System.Double|System.Char') {
$TargetData = [PSCustomObject]@{ $HeaderName = $TargetData }
}
if ($firstTimeThru) {
$firstTimeThru = $false
$isDataTypeValueType = ($null -eq $TargetData) -or ($TargetData.GetType().name -match 'string|timespan|datetime|bool|byte|char|decimal|double|float|int|long|sbyte|short|uint|ulong|ushort|URI|ExcelHyperLink')