diff --git a/Public/Import-Excel.ps1 b/Public/Import-Excel.ps1 index 3734f2bc..b9174738 100644 --- a/Public/Import-Excel.ps1 +++ b/Public/Import-Excel.ps1 @@ -145,7 +145,7 @@ } $targetSheetname = $sheet.Name - $xlBook["$targetSheetname"] = @() + $xlBook["$targetSheetname"] = [System.Collections.Generic.List[object]]::new() #region Get rows and columns #If we are doing dataonly it is quicker to work out which rows to ignore before processing the cells. if (-not $EndRow ) { $EndRow = $sheet.Dimension.End.Row } @@ -235,7 +235,7 @@ # Write-Verbose "Import cell '$($Worksheet.Cells[$R, $P.Column].Address)' with property name '$($p.Value)' and value '$($Worksheet.Cells[$R, $P.Column].Value)'." } } - $xlBook["$targetSheetname"] += [PSCustomObject]$NewRow + $xlBook["$targetSheetname"].Add([PSCustomObject]$NewRow) } #endregion }