【发布时间】:2016-04-29 10:53:00
【问题描述】:
我是 python 新手。我只是想使用 gspread 创建一个谷歌工作表。我从here 阅读了有关使用google api 的信息。我从Google Developers Console 下载了凭据,这是一个 json 格式的文件。然后我用了这段代码
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('spreadsheet1995.json', scope)
gc = gspread.authorize(credentials)
worksheet = gc.add_worksheet(title="A worksheet", rows="100", cols="20")
但它会引发错误'Client' object has no attribute 'add_worksheet',尽管我阅读了包含此属性的文档。这是我关注的link。请帮我解决这个问题。
【问题讨论】: