Search code examples
google-sheets-apigoogle-data-api

How to get first row from Google Spreadsheets Data API


Here is an example: https://spreadsheets.google.com/feeds/list/1a2JzZzUjSIcpROgR5v_M-UmWyT-iokcegIxHJOopZWA/od6/public/full?alt=json

The returned JSON data doesn't contain the first row from the spreadsheet. You can view the contents of the spreadsheet in HTML (https://docs.google.com/spreadsheets/d/1a2JzZzUjSIcpROgR5v_M-UmWyT-iokcegIxHJOopZWA/pubhtml) to verify that "first row" exists in the sheet.

How can I get the first row from the spreadsheet? There is a "openSearch$startIndex" = 1 in the returned JSON. Maybe if you could set this to 0, I could get the first row also.


Solution

  • 1st Row - Cell feed

    https://spreadsheets.google.com/feeds/cells/key/worksheetId/private/full?min-row=1&min-col=1&max-col=4

    Docs: https://developers.google.com/google-apps/spreadsheets/#fetching_specific_rows_or_columns

    Cell feed is better for almost everything. But append a data row is better in list feed, I think.