App Inventor & Google Sheets

I would like to know if Web1 URL export?format=csv can direct me to sheet2 of my google sheet similar to var = ss. getSheetByName(“Sheet2”) ;

I can already view sheet1 data but would like to know if their is an app inventor blocks equivalent ?

Thanks in advance

Mark G

Yes.

We must first assume that your spreadsheet is set to share as “anyone with the link”.

As you have found, to get the first sheet returned you can use this url (dummy fileID):

https://docs.google.com/spreadsheets/d/1mpC--JsHI9sdo9RDbLUGwTT_eoaV0DlgQKFsV3NJKk/export?format=csv

To call the data in a different sheet, you need the gid number for that sheet. The gid number can be found in the url address bar when you are viewing that sheet, and you add it to the end of the url. If, for example, you have a second sheet named Sheet2 and the gid number in the address bar is : 2131997720, then the url you need to download the data for the sheet named Sheet2 is:

https://docs.google.com/spreadsheets/d/1mpC--JsHI9sdo9RDbLUGwTT_eoaV0DlgQKFsV3NJKk/export?format=csv&gid=2131997720

You can go a step further if you only want a specific range, for example A2:B5, and add the range to the url as well:

https://docs.google.com/spreadsheets/d/1mpC--JsHI9sdo9RDbLUGwTT_eoaV0DlgQKFsV3NJKk/export?format=csv&gid=2131997720&range=A2:B5

1 Like

Building & testing now … Thanks

Works perfectly, Thanks for your help. Mark G

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.