How can I get single sheet from a spreadsheet collection from Google Sheets with Google Sheets API v4?

时间:2016-06-10 16:15:43

标签: google-sheets google-spreadsheet-api google-sheets-api

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?

1 个答案:

答案 0 :(得分:1)

此处的问题是当您使用ranges参数时,您必须使用A1表示法语法指定工作表标题,如本文档所述:https://developers.google.com/sheets/guides/concepts#sheet_id

我正在使用ranges参数并正确使用A1表示法,但我没有指定表格标题。在那种情况下,默认工作表是第一个。如果你想要获得除第一张之外的其他工作表,你必须指定标题,如下所示:

https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}?ranges=sheetTitle!A3:F20
相关问题