Reputation: 71
I'm trying to build a webapp based on Google Sheets. I'm a little bit confused with the API. I have a spreadsheet which is shared with me by Drive and contains 2 sheets. I can get the first sheet with
GET /v4/spreadsheets/{spreadsheetId}
Returns the spreadsheet at the given ID.
endpoint. But I couldn't figure out how to get the second sheet. Is there a way I can get spesific sheet from a spreadsheet?
Upvotes: 0
Views: 518
Reputation: 71
The problem in here is when you are using ranges
parameter you have to specify the sheet title with A1 notation syntax as described in this document: https://developers.google.com/sheets/guides/concepts#sheet_id
I was using the ranges
parameter and using the A1 notation correctly but I wasn't specifying the sheet title. In that scenario the default sheet is the first one. If you want the get another sheet other than the first one you have to specify the title, like this:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}?ranges=sheetTitle!A3:F20
Upvotes: 2