Pivot.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
function Pivot { [CmdletBinding()] param( $targetData, $pivotRows, $pivotData, [OfficeOpenXml.Drawing.Chart.eChartType]$ChartType="Pie" ) if(!$pivotData) {$pivotData=$pivotRows} $xlFile = [System.IO.Path]::GetTempFileName() -replace "tmp","xlsx" Write-Verbose $xlFile $targetData | Export-Excel -Path $xlFile ` -IncludePivotTable -IncludePivotChart ` -PivotRows $pivotRows -PivotData $pivotData ` -ChartType $ChartType ` -Show } |