【发布时间】:2019-07-02 16:51:59
【问题描述】:
我正在尝试一个项目,我可以使用 python(我在 Anaconda 上使用 jupyter 笔记本)从谷歌表格中读取数据。我观看了一些视频和指南并复制了代码。但是,我无法让代码正常工作
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())
我得到的错误信息是
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."
}
}
对我应该做什么有什么建议吗?
【问题讨论】:
标签: python google-sheets anaconda google-sheets-api