diff --git a/Examples/Tables/SalesData-WithTotalRow.ps1 b/Examples/Tables/SalesData-WithTotalRow.ps1 index 24f18c0..c5275d3 100644 --- a/Examples/Tables/SalesData-WithTotalRow.ps1 +++ b/Examples/Tables/SalesData-WithTotalRow.ps1 @@ -17,12 +17,13 @@ OrderId,Category,Sales,Quantity,Discount $xlfile = "$PSScriptRoot\TotalsRow.xlsx" Remove-Item $xlfile -ErrorAction SilentlyContinue -$TotalSettings = @{ +$TableTotalSettings = @{ Quantity = 'Sum' - Category = @{ - # Count the number of categories not equal to Electronics - Custom = '=COUNTIF([Category],"<>Electronics")' + Category = '=COUNTIF([Category],"<>Electronics")' # Count the number of categories not equal to Electronics + Sales = @{ + Function = '=SUMIF([Category],"<>Electronics",[Sales])' + Comment = "Sum of sales for everything that is NOT Electronics" } } -$data | Export-Excel -Path $xlfile -TableName Sales -TableStyle Medium10 -TotalSettings $TotalSettings -AutoSize -Show \ No newline at end of file +$data | Export-Excel -Path $xlfile -TableName Sales -TableStyle Medium10 -TableTotalSettings $TotalSettings -AutoSize -Show \ No newline at end of file diff --git a/Examples/Tables/TotalsRow.ps1 b/Examples/Tables/TotalsRow.ps1 index 1580dae..bf8e5f7 100644 --- a/Examples/Tables/TotalsRow.ps1 +++ b/Examples/Tables/TotalsRow.ps1 @@ -3,13 +3,14 @@ try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return} $r = Get-ChildItem C:\WINDOWS\system32 -File $TotalSettings = @{ - Length = "Sum" Name = "Count" - Extension = @{ - # You can create the formula in an Excel workbook first and copy-paste it here - # This syntax can only be used for the Custom type - Custom = "=COUNTIF([Extension];`".exe`")" + # You can create the formula in an Excel workbook first and copy-paste it here + # This syntax can only be used for the Custom type + Extension = "=COUNTIF([Extension];`".exe`")" + Length = @{ + Function = "=SUMIF([Extension];`".exe`";[Length])" + Comment = "Sum of all exe sizes" } } -$r | Export-Excel -TableName system32files -TableStyle Medium10 -TotalSettings $TotalSettings -Show \ No newline at end of file +$r | Export-Excel -TableName system32files -TableStyle Medium10 -TableTotalSettings $TotalSettings -Show \ No newline at end of file