【问题标题】:How to read rows after empty row in the Google spreadsheet?如何在 Google 电子表格中读取空行后的行?
【发布时间】:2011-07-26 14:44:03
【问题描述】:

我正在使用 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 电子表格中读取所有行。

任何帮助将不胜感激。

【问题讨论】:

    标签: gdata-api google-spreadsheet-api gdata-python-client


    【解决方案1】:

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

    所以,这里是 Google Docs 电子表格 API 的文档:

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

    答案就是:

    列表提要包含从第一行到第一行的所有行 空白行。

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

    干杯

    【讨论】:

      【解决方案2】:

      您可以使用CellFeed,以防您的电子表格之间有空行。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-02-13
        相关资源
        最近更新 更多