Closed szz22 closed 2 years ago
Please post a script of what you are trying to do that shows the issue
Script Export-Excel -Path "..." -WorksheetName ... -PivotTableName '...' -PivotRows '...' -PivotData @{... = '...' } -ChartType PieExploded3D -IncludePivotTable -IncludePivotChart -ShowCategory -ShowPercent -NoLegend
the option -ChartTitle wont work
Try this:
$data = ConvertFrom-Csv @"
Region,State,Units,Price
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
East,Maine,828,661.24
West,Virginia,465,053.58
North,Missouri,436,235.67
South,Kansas,214,992.47
North,North Dakota,789,640.72
South,Delaware,712,508.55
"@
$xlfile = './test.xlsx'
Remove-Item $xlfile -ErrorAction SilentlyContinue
$pivotTableParams = @{
PivotTableName = "SalesDataByRegion"
SourceWorkSheet = 'Sheet1'
PivotRows = @("Region")
PivotData = @{'Units' = 'sum' }
IncludePivotChart = $true
ChartTitle = "Sales by Region"
Activate = $true
}
$ptd = New-PivotTableDefinition @pivotTableParams
$data | Export-Excel $xlfile -TableName SalesData -PivotTableDefinition $ptd -Show
Hy, Thank you for your quick answer it works the Title the script that I made from your example is $xlfile = "......" $pivotTableParams = @{ PivotTableName = "...." SourceWorkSheet = '....' PivotRows = @("....") PivotData = @{'....' = 'Sum' } IncludePivotChart = $true ChartTitle = "....." Activate = $true NoLegend = $true Showpercent = $true ShowCategory = $true } $ptd = New-PivotTableDefinition @pivotTableParams Export-Excel $xlfile -PivotTableDefinition $ptd -HideSheet ....
The other problem I have is where can i define -ChartType PieExploded3D, and where can i rename my pivot columns Header (Row labels, Total) Thank you.
This is using PowerShell splatting. You can find the other params supported on New-PivotTableDefinition
using tab completion.
This module cannot rename those Pivot headers. I believe they are created when Excel opens the file.
$data = ConvertFrom-Csv @"
Region,State,Units,Price
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
East,Maine,828,661.24
West,Virginia,465,053.58
North,Missouri,436,235.67
South,Kansas,214,992.47
North,North Dakota,789,640.72
South,Delaware,712,508.55
"@
$xlfile = './test.xlsx'
Remove-Item $xlfile -ErrorAction SilentlyContinue
$pivotTableParams = @{
PivotTableName = "SalesDataByRegion"
SourceWorkSheet = 'Sheet1'
PivotRows = @("Region")
PivotData = @{'Units' = 'sum' }
IncludePivotChart = $true
ChartTitle = "Sales by Region"
ChartType = "PieExploded3D"
Activate = $true
}
$ptd = New-PivotTableDefinition @pivotTableParams -
$data | Export-Excel $xlfile -TableName SalesData -PivotTableDefinition $ptd -Show
Thank you for your answer, My question is if I could a Legend Series Value that works on Excel Practicaly I want 2 columns 3 columns to show: $xlfile = "......" $pivotTableParams = @{ PivotTableName = "...." SourceWorkSheet = '....' PivotRows = @("....") PivotData = @{'....' = 'Sum' ; '....' ='Min'} IncludePivotChart = $true ChartTitle = "....." Activate = $true NoLegend = $true Showpercent = $true ShowCategory = $true } $ptd = New-PivotTableDefinition @pivotTableParams Export-Excel $xlfile -PivotTableDefinition $ptd -HideSheet ....
Line 6 but the result apears enumerated behind PivotRows and not besides 1 2 3 I want 1 2 3
Thank you
Ok, I resolved $PivotDataToColumn = $true Thank you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Discussed in https://github.com/dfinke/ImportExcel/discussions/1241