1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

BigQueryでスプレットシート読み込み時にAccess Deniedエラー

Posted at

https://developers.google.com/apps-script/advanced/bigquery?hl=ja#run_query

上記チュートリアルに従ってGoogle Apps Script(GAS)を使ってBigQueryにアクセスしようとしたところ以下のエラーが発生しました。

GoogleJsonResponseException: API call to bigquery.jobs.query failed with error: Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials.

解決方法

以下の方法で解消できました。

  1. GASの*[サービス]*で Google Drive API を有効にする
    スクリーンショット 2023-03-20 23.24.55.png

  2. DriveApp.getRootFolder();を関数の先頭に追加して、Drive Auth Scope を取得。

function runQuery() {
  DriveApp.getRootFolder();
  ...以下略
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?