这是我第一次使用脚本编辑器.我被分配做一个脚本来为谷歌表格的数据透视表.
//creating pivot table through script editor for google sheet
function addPivotTable() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheetName = "Sheet1";
// Create a new sheet which will contain our Pivot Table
var pivotTableSheet = ss.insertSheet();
var pivotTableSheetId = pivotTableSheet.getSheetId();
// Add Pivot Table to new sheet
// Meaning we send an 'updateCells' request to the Sheets API
// Specifying via 'start' the sheet where we want to place our Pivot Table
// And in 'rows' the parameters of our …Run Code Online (Sandbox Code Playgroud)