我想通过Python访问Google表单:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import json
GDriveJSON = 'D:\毕业设计\PythonUpload.json'
GSpreadSheet = 'New Stories'
json_key = json.load(open(r'D:\毕业设计\PythonUpload.json'))
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name(GDriveJSON, scope)
gc = gspread.authorize(credentials)
但是在打开的时候:
ws = gc.open(GSpreadSheet).sheet1
返回了403错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Program Files\Python36\lib\site-packages\gspread\client.py", line 122, in open
self.list_spreadsheet_files()
File "D:\Program Files\Python36\lib\site-packages\gspread\client.py", line 96, in list_spreadsheet_files
res = self.request('get', url, params=params).json()
File "D:\Program Files\Python36\lib\site-packages\gspread\client.py", line 79, in request
raise APIError(response)
gspread.exceptions.APIError: {
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
请问应该怎么修改呢?