We frequently use Google Apps script to run BigQuery queries and put them into a Google Sheet. However, the workflow is annoying:
If you query data in BigQuery, build reports and visualize results on a regular basis, you will enjoy our free Add-on for Google Sheets.
It will make your workflow easier.
Benefits:
Any suggestions and comments are welcome.
Its a workaround...
try saving as a view, and execute a simple
Select * from MyView
At my blog, I wrote an article that shows how to front-end a BigQuery project with a Google Apps Script application "owned" by a Google Drive spreadsheet. The article describes a simple example application available at my GitHub repository. This sample application
1) builds a web page that directly queries BigQuery
2) shows the result set on the web page
3) mirrors the result set on the spreadsheet
The sample solution has two small files - that's it. You probably have a BigQuery project more complicated than the one featured in the article, but the main idea of the article / sample should extend to your situation.
BigQuery Team definitely has some secret sauce here as they actually have this functionality in their Native BigQuery UI – you can save and then reuse it from within that UI
As of using saved query programmatically I can recommend this route: