2
1

More than 3 years have passed since last update.

GAS Exception: Ui.showModalDialog を呼び出す権限がありません。

Last updated at Posted at 2020-02-28

実際にはDriveAppを呼び出そうとして怒られた。
他のGoogle関連サービスを利用するには、appsscript.jsonにoauthScopesエントリを追加するとよいようだ。最終的には以下のようになった

appsscript.json
{
  "timeZone": "Asia/Tokyo",
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "oauthScopes": [
    "https://www.googleapis.com/auth/drive.readonly",
    "https://www.googleapis.com/auth/drive",
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/spreadsheets",
    "https://www.googleapis.com/auth/script.container.ui"
  ]  
}

もともとスプレットシートとUIを使えるようにスコープには書いてあったが、
oauthScopesエントリにDriveだけ追加したら、Sheetで怒られ、uiで怒られ、毎回エントリ足す、実行時にダイアログでる、という結果に。

これも備忘録的に書いとこう〜

2
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
2
1