-
I'm creating a worksheet
|
Beta Was this translation helpful? Give feedback.
Answered by
ninmonkey
Dec 2, 2022
Replies: 2 comments 1 reply
-
Not sure if this is what you are looking for, but it may be a start for you. $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
"@
$path = 'c:\temp\test1.xlsx'
Remove-Item -Path $path -ErrorAction SilentlyContinue
$pkg = $data | Export-Excel -Path $path -PassThru
Add-ExcelTable -Range $pkg.Sheet1.Cells["A1:D5"] -TableStyle Medium6 -TotalSettings @{Region="Count"}
Close-ExcelPackage $pkg -Show |
Beta Was this translation helpful? Give feedback.
0 replies
-
That got me there. here's a version without a commandlet [OfficeOpenXml.ExcelPackage]$pkg2 = Open-ExcelPackage $Path.Dest
[OfficeOpenXml.Table.ExcelTable]$table1 = $pkg2.Sheet1.Tables[0]
$rowFunc = [OfficeOpenXml.Table.RowFunctions]
$table1.Columns[0].TotalsRowFunction = $rowFunc::Count
$table1.Columns[2].TotalsRowFunction = $rowFunc::Average |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dfinke
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That got me there. here's a version without a commandlet