works with multiple sheets

This commit is contained in:
dfinke
2017-10-12 11:33:49 -04:00
parent 1004d8a9ea
commit 57c02a466d
2 changed files with 47 additions and 19 deletions

View File

@@ -1,25 +1,37 @@
"To ship, is to choose"
# To ship, is to choose
ipmo .\ImportExcel.psd1 -Force
$file = "c:\temp\testPT.xlsx"
rm $file -ErrorAction Ignore
$pt=[ordered]@{}
$pt.PT1=@{
SourceWorkSheet='Sheet1'
PivotRows = "Status"
PivotData= @{'Status'='count'}
IncludePivotChart=$true
ChartType='BarClustered3D'
}
$pt.PT2=@{
PivotRows = "StartType"
PivotData= @{'StartType'='count'}
SourceWorkSheet='Sheet2'
PivotRows = "Company"
PivotData= @{'Company'='count'}
IncludePivotChart=$true
ChartType='PieExploded3D'
}
$gsv=Get-Service | Select-Object status, Name, displayName, starttype
$ps=Get-Process | Select-Object Name,Company, Handles
$file = "c:\temp\testPT.xlsx"
rm $file -ErrorAction Ignore
$gsv| Export-Excel -Path $file -AutoSize
$ps | Export-Excel -Path $file -AutoSize -WorkSheetname Sheet2 -PivotTableDefinition $pt -Show
return
Get-Service |
select status, Name, displayName, starttype |
Export-Excel -Path $file -Show -PivotTable $pt -AutoSize
Export-Excel -Path $file -Show -PivotTable $pt -AutoSize