...
- Line1:
- Line11: Set the location where excell will be saved
- Line13: Create a variable $WorkSheetName which is used to store the name of the worksheet.
- Line14: creates a spreadsheet, and pass passes on the Excel Package object which provides the reference to the workbook and turns to the worksheets inside it.
- Line20: PivotTableName parameter is used as the Name for the new PivotTable.
- Line21: By default, a PivotTable will be created on its own sheet, but it can be created on an existing sheet. $excel.$WorkSheetName.cells["K1"] defines the cell place in the existing worksheet, where the pivot table will be created.
- Line22: $excel.$WorkSheetName refers to the Worksheet where the source data is found.
- Line23: PivotRows parameter is used for Fields to set as rows in the PivotTable.
- Line24: PivotData parameter contains a hash table in form "FieldName"="Function," where a function is one of Average, Count, CountNums, Max, Min, Product, None, StdDev, StdDevP, Sum, Var, VarP.
- Line25: Apply a table style to the PivotTable. The PivotTableStyle “Medium6” is the default table style but there are plenty of others to choose from. Example: PivotTableStyles = None, Custom, Light1 to Light21, Medium1 to Medium28, Dark1 to Dark11".