I created a Google Sheet that extracts data from Big Query via a sidebar. I am able to get the data when I run the function via a custom menu or if I execute the function from the Editor. The function simply queries a table in BQ and outputs the data in the sheet.
However, I'm getting an error when I try to run the function via a submit button in the sidebar. I am using google.script.run in the HTML file to execute the Apps Script function. Here's the error that I'm getting:
Error: GoogleJsonResponseException: API call to bigquery.jobs.query failed with error: Access Denied: Project xxx: User does not have bigquery.jobs.create permission in project xxx.
Again, I am able to access BQ from a custom menu or from the Editor which means I have access to BQ, I believe. So I am not sure how to resolve this kind of error. I have been trying to rummage the internet for a solution but to no avail. I hope someone can help. Thanks in advance!