SHARE
TWEET

Untitled

a guest Jun 18th, 2019 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function MassUpdateofFilters() {
  2.     var spreadsheet = SpreadsheetApp.getActive();
  3.     spreadsheet.getRange('Andrew!A1').activate();
  4.     var sourceData = spreadsheet.getRange('Batches!1:997');
  5.     var pivotTable = spreadsheet.getRange('A1').createPivotTable(sourceData);
  6.     pivotTable.setValuesDisplayOrientation(SpreadsheetApp.Dimension.ROWS);
  7.     var pivotValue = pivotTable.addPivotValue(3, SpreadsheetApp.PivotTableSummarizeFunction.SUM);
  8.     var pivotGroup = pivotTable.addRowGroup(5);
  9.     pivotGroup.showTotals(false)
  10.         .sortDescending()
  11.         .sortBy(pivotTable.getPivotValues()[0], []);
  12.     pivotGroup = pivotTable.addRowGroup(4);
  13.     pivotGroup.showTotals(false);
  14.     var criteria = SpreadsheetApp.newFilterCriteria()
  15.         .setVisibleValues(['Andrew'])
  16.         .build();
  17.     pivotTable.addFilter(5, criteria);
  18.     criteria = SpreadsheetApp.newFilterCriteria()
  19.         .setVisibleValues([ '1', '2', '3', '5', '6', '7'])
  20.         .build();
  21.     pivotTable.addFilter(16, criteria);
  22.     criteria = SpreadsheetApp.newFilterCriteria()
  23.         .setVisibleValues(['April'])
  24.         .build();
  25.     pivotTable.addFilter(15, criteria);
  26.     criteria = SpreadsheetApp.newFilterCriteria()
  27.         .setVisibleValues(['2019'])
  28.         .build();
  29.     pivotTable.addFilter(17, criteria);
  30. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top