mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-11 13:53:20 +00:00
Updated Examples
This commit is contained in:
@@ -17,12 +17,13 @@ OrderId,Category,Sales,Quantity,Discount
|
|||||||
$xlfile = "$PSScriptRoot\TotalsRow.xlsx"
|
$xlfile = "$PSScriptRoot\TotalsRow.xlsx"
|
||||||
Remove-Item $xlfile -ErrorAction SilentlyContinue
|
Remove-Item $xlfile -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
$TotalSettings = @{
|
$TableTotalSettings = @{
|
||||||
Quantity = 'Sum'
|
Quantity = 'Sum'
|
||||||
Category = @{
|
Category = '=COUNTIF([Category],"<>Electronics")' # Count the number of categories not equal to Electronics
|
||||||
# Count the number of categories not equal to Electronics
|
Sales = @{
|
||||||
Custom = '=COUNTIF([Category],"<>Electronics")'
|
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
|
$data | Export-Excel -Path $xlfile -TableName Sales -TableStyle Medium10 -TableTotalSettings $TotalSettings -AutoSize -Show
|
||||||
@@ -3,13 +3,14 @@ try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
|
|||||||
$r = Get-ChildItem C:\WINDOWS\system32 -File
|
$r = Get-ChildItem C:\WINDOWS\system32 -File
|
||||||
|
|
||||||
$TotalSettings = @{
|
$TotalSettings = @{
|
||||||
Length = "Sum"
|
|
||||||
Name = "Count"
|
Name = "Count"
|
||||||
Extension = @{
|
# You can create the formula in an Excel workbook first and copy-paste it here
|
||||||
# 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
|
||||||
# This syntax can only be used for the Custom type
|
Extension = "=COUNTIF([Extension];`".exe`")"
|
||||||
Custom = "=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
|
$r | Export-Excel -TableName system32files -TableStyle Medium10 -TableTotalSettings $TotalSettings -Show
|
||||||
Reference in New Issue
Block a user