Is there a method in Google Apps script for Pivot Table? I can't find anything in the documentation that creates a Pivot Table from a data range in a sheet using Google Apps Script.
Thanks in advance.
Is there a method in Google Apps script for Pivot Table? I can't find anything in the documentation that creates a Pivot Table from a data range in a sheet using Google Apps Script.
Thanks in advance.
Try google query with pivot. That should work. For example:
=QUERY(Sheet1!A1:C, "select B, count(C) group by B pivot A")
This is now possible. Google provides an example in their Advanced Google Services tutorial. The solution presumes you enable the Sheets API in "Advanced Google services..." for the project at hand and also enable the API in the Developer Console.
That said, there is one caveat here. It seems there is a bug with integrating pivot filter criteria, as mentioned here: Pivot Filter Criteria not Properly Applied
There is no programmatic way to create a pivot table from Apps Script. You can add support for this feature by "staring" the issue at:
https://code.google.com/p/google-apps-script-issues/issues/detail?id=3158