You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/tables/create-pivot-table.ts
+16-17Lines changed: 16 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
/**
2
-
* Creates a pivot table from an existing table with specified row and value aggregations.
3
-
*
4
-
* @param tableName Name of the source table for the pivot table.
5
-
* @param location Where to place the pivot table: "New sheet" creates a new worksheet, "Existing sheet" places it below the source table unless a sheet name is specified.
6
-
* @param rowsColumn Column name to use for pivot table rows.
7
-
* @param valuesColumns Array of column names to aggregate in the pivot table values area.
8
-
* @param valuesOperation Aggregation function to apply to the values columns.
9
-
* @param sheetName The name of the sheet the pivot table should be placed on when location is Existing sheet (defaults to same sheet as table). If location is New sheet, this is the name the new sheet should have.
10
-
* @param pivotTableName Optional name for the pivot table (auto-generates if blank or already exists);
11
-
*/
2
+
* Creates a pivot table from an existing table with specified row and value aggregations.
3
+
*
4
+
* @param tableName Name of the source table for the pivot table.
5
+
* @param location Where to place the pivot table: "New sheet" creates a new worksheet, "Existing sheet" places it below the source table unless a sheet name is specified.
6
+
* @param rowsColumn Column name to use for pivot table rows.
7
+
* @param valuesColumns Array of column names to aggregate in the pivot table values area.
8
+
* @param valuesOperation Aggregation function to apply to the values columns.
9
+
* @param sheetName The name of the sheet the pivot table should be placed on when location is Existing sheet (defaults to same sheet as table). If location is New sheet, this is the name the new sheet should have.
10
+
* @param pivotTableName Optional name for the pivot table (auto-generates if blank or already exists)
11
+
*/
12
12
functionmain(
13
13
workbook: ExcelScript.Workbook,
14
14
tableName: string,
@@ -22,22 +22,22 @@ function main(
22
22
){
23
23
consttable=workbook.getTable(tableName);
24
24
if(!table){
25
-
thrownewError(`Table "${tableName}" not found.`);
25
+
thrownewError(`Table '${tableName}' not found.`);
26
26
}
27
27
28
28
if(table.getRowCount()===0){
29
-
thrownewError(`Table "${tableName}" has no data.`);
29
+
thrownewError(`Table '${tableName}' has no data.`);
0 commit comments