mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Added Example for using PivotFilter
This commit is contained in:
23
Examples/PivotTableFilters/testPivotFilter.ps1
Normal file
23
Examples/PivotTableFilters/testPivotFilter.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
Import-Module ..\..\ImportExcel.psd1 -Force
|
||||||
|
|
||||||
|
$xlFile=".\testPivot.xlsx"
|
||||||
|
Remove-Item $xlFile -ErrorAction Ignore
|
||||||
|
|
||||||
|
|
||||||
|
$data =@"
|
||||||
|
Region,Area,Product,Units,Cost
|
||||||
|
North,A1,Apple,100,.5
|
||||||
|
South,A2,Pear,120,1.5
|
||||||
|
East,A3,Grape,140,2.5
|
||||||
|
West,A4,Banana,160,3.5
|
||||||
|
North,A1,Pear,120,1.5
|
||||||
|
North,A1,Grape,140,2.5
|
||||||
|
"@ | ConvertFrom-Csv
|
||||||
|
|
||||||
|
$data |
|
||||||
|
Export-Excel $xlFile -Show `
|
||||||
|
-AutoSize -AutoFilter `
|
||||||
|
-IncludePivotTable `
|
||||||
|
-PivotRows Product `
|
||||||
|
-PivotData @{"Units"="sum"} `
|
||||||
|
-PivotFilter Region, Area `
|
||||||
Reference in New Issue
Block a user