我正在使用 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/