From 494ac51ae51e1919c65ce4d24016c025cfaab747 Mon Sep 17 00:00:00 2001 From: ili101 Date: Sun, 7 Apr 2019 22:11:31 +0300 Subject: [PATCH] Replace " | Out-Null" with "$null = " doble performance on DataTable --- Export-Excel.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 4655236..7b819a9 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -625,7 +625,7 @@ if it was passed it is a data table don't do foreach on it (slow) put the whole table in and set dates on date columns, set things up for the end block, and skip the process block #> if ($InputObject -is [System.Data.DataTable]) { - $ws.Cells[$row,$StartColumn].LoadFromDataTable($InputObject, (-not $noHeader) ) | Out-Null + $null = $ws.Cells[$row,$StartColumn].LoadFromDataTable($InputObject, (-not $noHeader) ) foreach ($c in $InputObject.Columns.where({$_.datatype -eq [datetime]})) { Set-ExcelColumn -Worksheet $ws -Column ($c.Ordinal + $StartColumn) -NumberFormat 'Date-Time' }