The Google Sheets API documentation contains: A guide describing how and why to use the Google Sheets API to create pivot tables in your spreadsheets: https://developers.google.com/sheets/api/guides/pivot-tables Examples illustrating how you can achieve some common pivot table operations with the API: https://developers.google.com/sheets/api/samples/pivot-tables The Apps Script documentation also