I am trying to create a custom Google Sheets function that pulls data from the Analytics Reporting V4 API. When I run this function from the App Scripts console, it successfully returns data.
When I run the function from within my spreadsheet, I get the following error:
API call to analyticsreporting.reports.batchGet failed with error: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. (line 59).
Here is my function defined in the Apps Script Editor (again, this works fine when I press the run button from here):
And here is my error-producing spreadsheet implementation:
Is there a way that I can make this work without having to use OAuth credentials? From my understanding, the benefit of using Advanced Google Services is the ability to avoid this authentication flow, and I would like to take advantage of it.


