开发者

How to read rows after empty row in the Google spreadsheet?

I'm using gdata-python-client to read data from a Google spreadsheet. My code for reading rows is as follows:

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)

Let's say, the spreadsheet has 160 rows and the 12th row is empty. When I try to read all 160 rows using the above code, it only reads the first 11 rows (that is, until it gets the empty 12th row). If the spreadsheet doesn't have any empty rows, the code reads all 160 rows.

When I try to read the next rows from the empty row, it returns nothing. for example:

entries = first_sheet.GetRecords(50, 55) # entries is None
开发者_C百科

How can I read all the rows from a Google spreadsheet which contains empty rows.

Any help would be appreciated.


Sorry, may be it's too late, I just found this question. :)

So, here is the documentation of Google Docs spreadsheet API:

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

and there is the answer:

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

BTW, I think when the feed ends, there aren't much rows; you see it in vain. :)

Cheers


You can use CellFeed in case your spreadsheet has empty rows in between.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜