Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberFormat not applied to cells in PivotTable #32

Open
PeterGeelen opened this issue May 23, 2016 · 0 comments
Open

NumberFormat not applied to cells in PivotTable #32

PeterGeelen opened this issue May 23, 2016 · 0 comments

Comments

@PeterGeelen
Copy link

I'm using Powershell to pull datetime values in Excel and next the script generates a PivotTable for each table.
(using the dfinke/ImportExcel module).

To format cells in hh:mm:ss format, I use PSExcel module.
For the plain tables the format works fine.
But the data in the PivotTables are not formatted as requested...

Format Data Worksheet

$Sheetnames = 'Min', 'Max', 'Average', 'Errors', 'ErrorTypes'

foreach ($sheet in $Sheetnames)
{
$Worksheet = $Excel | Get-Worksheet -Name $sheet
$Worksheet | Format-Cell -StartColumn 4 -EndColumn 4 -Autofit -NumberFormat 'hh:mm:ss'
}

Format Pivot Worksheet

$Sheetnames = 'MinPivotTable', 'MaxPivotTable', 'AveragePivotTable'

foreach ($sheet in $Sheetnames)
{
$Worksheet = $Excel | Get-Worksheet -Name $sheet
$Worksheet | Format-Cell -StartColumn 2 -EndColumn 8 -Autofit -NumberFormat 'hh:mm:ss'

Any suggestion how to get this working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant