Run a saved bigquery query from Google Apps Script?

前端 未结 4 1147
忘掉有多难
忘掉有多难 2021-02-10 20:41

We frequently use Google Apps script to run BigQuery queries and put them into a Google Sheet. However, the workflow is annoying:

  1. Run the query in BigQuery until y
4条回答
  •  伪装坚强ぢ
    2021-02-10 21:19

    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:

    1. run your query anyhow and get respective jobid
    2. do jobs/get (https://cloud.google.com/bigquery/docs/reference/v2/jobs/get) for that specific jobid within your script to get configuration.query.query that consists of query text
    3. then just use it the way you need
    4. if to properly wrap it – can be quite useful :0)

提交回复
热议问题