【问题标题】:Google Spreadsheets API: 'SpreadsheetsClient' object has no attribute 'update_cell'Google 电子表格 API:“SpreadsheetsClient”对象没有属性“update_cell”
【发布时间】:2014-06-16 19:03:34
【问题描述】:

由于某种原因,当我尝试使用 Python 中的 Google 电子表格 API 更新一个单元格时,如下所示:

import gdata.spreadsheets.client 
import gdata.gauth

gd_client = gdata.spreadsheets.client.SpreadsheetsClient()
gd_client.auth_token = gdata.gauth.OAuth2TokenFromCredentials(credentials)

wksht_id = od6

gd_client.update_cell(spreadsheet_k, wksht_id, 3, 17, 'TEST')

我收到此错误:

AttributeError: 'SpreadsheetsClient' object has no attribute 'update_cell'

尽管在 client.py 的源代码中,update_cell 显然是 SpreadsheetsClient 类的一个方法:https://code.google.com/p/gdata-python-client/source/browse/src/gdata/spreadsheets/client.py

这个单元格中有一些东西,如果这有什么不同的话。但这不是错误的来源。我只是不知道为什么这不起作用。也许与不同版本的 API 有关?

我没看到什么?

【问题讨论】:

    标签: python google-spreadsheet-api google-drive-api


    【解决方案1】:

    想通了!结果发现源代码是用 update_cell 方法更新的,但由于某种原因,gdata 下载从未使用过这种方法。您必须转到源代码并将方法复制到您自己的 gdata 副本中,或者使用此解决方法:https://gist.github.com/egor83/4634422

    【讨论】:

      猜你喜欢
      • 2023-04-02
      • 1970-01-01
      • 1970-01-01
      • 2019-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-04
      • 1970-01-01
      相关资源
      最近更新 更多