【发布时间】:2017-02-14 18:14:01
【问题描述】:
我正在阅读 gspread (http://gspread.readthedocs.io/en/latest/oauth2.html) 的文档,并且已经能够让介绍性代码块正常工作:
import gspread
gc = gspread.authorize(credentials)
但是当我运行以下脚本时:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('My Project-******97.json', scope)
gc = gspread.authorize(credentials)
wks = gc.open("rules_test_1.csv").sheet1
我明白了:
gspread.exceptions.SpreadsheetNotFound
我如何才能访问此工作表?
【问题讨论】:
-
您能解释一下“我在 Google 云端硬盘中没有工作表”是什么意思吗? Sheets 是应用程序,Drive 是 Sheets 保存工作表的地方。如果您按照您发布的链接中的步骤操作,您最终将获得服务帐户的身份验证。确保您了解服务帐户不是您自己的帐户。
-
我对这个问题做了一些修改..
标签: google-sheets google-drive-api google-oauth gspread