Sheets API PERMISSION_DENIED

1,942 views
Skip to first unread message

diana.n...@noaa.gov

unread,
Jul 19, 2016, 5:09:57 PM7/19/16
to Google API Python Client
I was able to get the quick start example working for Google Sheets Python API.  However, when I tried to access another sheet I created, I get:

Traceback (most recent call last):
  File "getSnowReports.py", line 76, in <module>
    main()
  File "getSnowReports.py", line 64, in main
    spreadsheetId=spreadsheetId, range=rangeName).execute()
  File "/usr/lib/python2.7/site-packages/oauth2client/util.py", line 135, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/googleapiclient/http.py", line 832, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://sheets.googleapis.com/v4/spreadsheets/1loxdIjhZlU4xND7sj9NIbWfCPvg7j41wRIBnDJhPGOw/values/Class%20Data%21A2%3AF?alt=json returned "Unable to parse range: Class Data!A2:F">

The contents of the json file in above URL is:

{
  • error
    {
    • code403,
    • message"The request cannot be identified with a client project. Please pass a valid API key with the request.",
    • status"PERMISSION_DENIED"
    }
}

How do I pass API key to sheets API?

Thanks.

Ahmet Emre Eser

unread,
Aug 30, 2016, 9:17:27 PM8/30/16
to Google API Python Client
I think you just need to change update the name of the sheet you're looking at, i.e. in quickstart.py, change "Class Data" in the line which says rangeName = 'Class Data!A2:E'
Reply all
Reply to author
Forward
0 new messages