-1

I am trying to query data from one of my google spreadsheets, and I have read the docs here.

My spreadsheet has two tabs/sheets. I can query data from the first sheet, but I can't figure out how to query data from the second sheet.

My query url looks like this:

https://docs.google.com/spreadsheets/d/[SpreadSheetId]/gviz/tq?tq=[query]

If I open the sheet in a browser I can see the sheet Id in the browser url:

https://docs.google.com/spreadsheets/d/[SpreadSheetId]/edit#gid=[SheetId]

Is there any way to specify this sheetId in the query url? I have tried adding various versions of /#gid=[sheetId] to my query url but it returns the full html of the page, not the json I expect.

tehhowch
  • 9,645
  • 4
  • 24
  • 42
Niels
  • 1,366
  • 15
  • 21
  • 1
    Related: https://stackoverflow.com/questions/48511747/using-google-query-to-download-parts-of-a-published-sheet – tehhowch Aug 07 '18 at 13:18

1 Answers1

0

The answer is:

https://docs.google.com/spreadsheets/d/[spreadSheetId]/gviz/tq?gid=[sheetId]&tq=[query]

Credits to tehhowch for pointing me in the right direction!

Niels
  • 1,366
  • 15
  • 21