gdata-api - 如何读取 Google 电子表格中空行后的行?

标签 gdata-api google-sheets-api gdata-python-client

我正在使用 gdata-python-client从 Google 电子表格中读取数据。我读取行的代码如下:

import gdata.speadsheet.text_db

gd_client = gdata.spreadsheet.text_db.DatabaseClient(
                     username=setting['account_name'],
                     password=setting['account_pass'])

xls_db = gd_client.GetDatabases(spreadsheet_key=setting['spreadsheet_id'])
first_sheet = xls_db[0].GetTables()[0]
entries = first_sheet.GetRecords(1, 200)

假设电子表格有 160 行,第 12 行是空的。当我尝试使用上面的代码读取所有 160 行时,它只读取前 11 行(也就是说,直到它获得空的第 12th 行)。如果电子表格没有任何空行,代码将读取所有 160 行。

当我尝试从空行读取下一行时,它没有返回任何内容。例如:

entries = first_sheet.GetRecords(50, 55) # entries is None

如何从包含空行的 Google 电子表格中读取所有行。

如有任何帮助,我们将不胜感激。

最佳答案

抱歉,可能为时已晚,我才发现这个问题。 :)

因此,这是 Google Docs 电子表格 API 的文档:

http://code.google.com/apis/spreadsheets/data/3.0/developers_guide.html

答案是:

The list feed contains all rows after the first row up to the first blank row.

顺便说一句,我认为当提要结束时,行数不多;你看到它是徒劳的。 :)

干杯

关于gdata-api - 如何读取 Google 电子表格中空行后的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6831857/

相关文章:

android - 在 android 日历中插入事件时出现异常

php - 如何删除所有换行符并从 PHP 中的字符串中转义字符?

python - 如何正确连接Google Spreadsheets API?

python - 我的应用程序有 "Authorization code"。但是我怎样才能使用它在使用 gdata-python-client 的博客中发帖呢?

google-api - Google+ 有公共(public) API 吗?

google-apps-script - 如何在 Google Apps 脚本中获取发布到网络电子表格的 ID

java - 以编程方式编辑 Google 电子表格

python - gdata-python-client 中的 gdata.client 和 gdata.service 有什么不同?

python - AuthSub 问题

java - 使用 Java Web 应用程序中的 Google Docs API ( Gdata) 上传文档