我正在尝试一个项目,我可以使用 python(我在 Anaconda 上使用 jupyter notebooks)从谷歌表中读取数据。我看了一些视频和指南并复制了代码。但是,我无法使代码正常工作
import pandas as pd
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('test.json',scope)
client = gspread.authorize(creds)
data = gc.open('TEST').sheet1
print(data.get_all_records())
Run Code Online (Sandbox Code Playgroud)
我得到的错误信息是
APIError: {
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission: Request had insufficient authentication scopes."
}
],
"code": 403,
"message": "Insufficient Permission: Request had insufficient authentication scopes."
}
}
Run Code Online (Sandbox Code Playgroud)
关于我应该做什么的任何建议?