PSExcel icon indicating copy to clipboard operation
PSExcel copied to clipboard

Export-XLSX Name the PivotTable worksheet

Open DarkLite1 opened this issue 10 years ago • 0 comments

Is it possible to add a parameter to name the worksheet where the PivotTable is produced?

In the module of dfinke they use the following::

Get-Process | Export-Excel $File  -WorkSheetname memory `
    -IncludePivotTable -PivotRows Company -PivotData PM `
    -IncludePivotChart -ChartType PieExploded3D -Show

In this example the Worksheet with the data is named 'memory' and the worksheet with the PivotTable is named 'memoryPivotTable'.

When we do the same with our function, the worksheet is called 'memory' but the PivotTable is called 'PivotTable1':

Get-Process | Export-XLSX -Path $File  -WorksheetName memory `
    -PivotRows Company -PivotValues PM `
    -ChartType PieExploded3D

It would be nice to have a parameter to choose a custom name for the worksheet of the PivotTable.

As an extra bonus it would also be great to have the worksheet with the 'PivotTable' as the active sheet, when you open the file for the first time.

DarkLite1 avatar Jul 27 '15 12:07 DarkLite1