I need help to update a pivotTable with google app script. Is there a good way to do it?
The pivotTable will create with the following function:
function pivotTableTest() {
// Ask for the source spreadsheet name
// Has to enter with range!
var ui = SpreadsheetApp.getUi();
var sourceSpreadsheet = ui.prompt("Enter the sheet name with range:");
Logger.log(sourceSpreadsheet.getResponseText());
Logger.log(sourceSpreadsheet.getSelectedButton());
// Create PivotTable
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sourceData = spreadsheet.getRange(sourceSpreadsheet.getResponseText());
var pivotTable = spreadsheet.getRange('B3').createPivotTable(sourceData);
// Add Rows
var pivotGroup = pivotTable.addRowGroup(3);
Now I need a function to add Values to the pivotTable:
function addValue() {
//???????????????????????????????????????
//pivotValue = pivotTable.addPivotValue(31, SpreadsheetApp.PivotTableSummarizeFunction.SUM);
}
But I don't know how to write the function, because the only way to do this was create a new PivotTable..
Thanks for your help!