LoginSignup
11
8

More than 5 years have passed since last update.

ScalaでGoogle SpreadSheetAPI使って以下エラーが表示された場合

Posted at

問題

google-api-clientを使用しGoogleのSpreadSheetのクライアントをscalaで作ったが、アクセス時に403になった。ハマったのでメモ

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "message" : "The caller does not have permission",
    "reason" : "forbidden"
  } ],
  "message" : "The caller does not have permission",
  "status" : "PERMISSION_DENIED"
}

原因と解決

今回service accountを使用してアクセスしようとしたが、アクセスしたいファイルに当該service accountのアクセス権限がなかったが原因。

  1. google sheet編集画面の右上の「共有」ボタンを押して出るダイアログに、service accountのメアドを入力。

image.png

  1. 送信ボタンで権限設定が完了する
11
8
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
11
8