From 5aa37f62ea14a9c574001371d4024d50bfde2377 Mon Sep 17 00:00:00 2001 From: 6v4tq8mhlO23a Date: Sat, 24 May 2025 17:32:08 +0200 Subject: [PATCH] Fixes inefficient array usage --- Public/Import-Excel.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 }