RefreshAllPivots
Refreshes all pivot tables.
Syntax
expression.RefreshAllPivots();
expression - A variable that represents an Api class.
Parameters
This method doesn't have any parameters.
Returns
This method doesn't return any data.
Example
Refresh all pivot tables so they reflect the latest source data in a spreadsheet.
// How do I update every pivot table at once when the underlying data changes in a spreadsheet?
// Synchronize all summary views with the most recent data in a spreadsheet.
let worksheet = Api.GetActiveSheet();
worksheet.GetRange('B1').SetValue('Region');
worksheet.GetRange('C1').SetValue('Price');
worksheet.GetRange('B2').SetValue('East');
worksheet.GetRange('B3').SetValue('West');
worksheet.GetRange('C2').SetValue(42.5);
worksheet.GetRange('C3').SetValue(35.2);
let dataRef = Api.GetRange("'Sheet1'!$B$1:$C$3");
let pivotTable = Api.InsertPivotNewWorksheet(dataRef);
Api.GetPivotByName(pivotTable.GetName()).AddFields({
rows: 'Region',
});
Api.GetPivotByName(pivotTable.GetName()).AddDataField('Price');
Api.RefreshAllPivots();