错误:gspread.exceptions.APIError:{'代码':403,'消息':'呼叫者没有权限','状态':'PERMISSION_DENIED'}

时间:2020-10-31 02:27:12

标签: google-drive-api google-sheets-api credentials gspread google-developers-console

我需要将Google驱动器上的数据库加载到笔记本电脑上的pyCharm,我根据此链接设置了所有内容:[https://towardsdatascience.com/how-to-in-integrate-google-sheets-and-jupyter -notebooks-c469309aacea],最后是我的代码:

import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pandas as pd
from pandas.io.json import json_normalize
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('./my-project-ml-293621-aeb4b147f1ae.json', scope)
gc = gspread.authorize(credentials)
spreadsheet_key = '1uj829biJO-KHk6cXY0KaBx_qm9rbyKYxDB4ssz8rxUs'
book = gc.open_by_key(spreadsheet_key)
worksheet = book.worksheet("weather")
table = worksheet.get_all_values()

但我收到此错误:

gspread.exceptions.APIError: {'code': 403, 'message': 'The caller does not have permission', 'status': 'PERMISSION_DENIED'}

任何人都可以帮助我找出我的代码中的问题吗?

0 个答案:

没有答案