Accessing a (new-style, public) Google sheet as JSON

后端 未结 5 1733
臣服心动
臣服心动 2020-12-04 08:41

How can I access the contents of a (new-style) Google sheet a JSON? My aim is to access the values from JavaScript, so I need to be able to download the JSON via HTTP.

5条回答
  •  失恋的感觉
    2020-12-04 08:51

    Here's how to get the JSON using those same URL parameters:

    "https://spreadsheets.google.com/feeds/list/" + spreadsheetID + "/od6/public/values?alt=json";
    

    Creds to @jochen on the answer with the path all the way up to XML "https://spreadsheets.google.com/feeds/list/" + spreadsheetID + "/od6/public/" + sheetID;

    As @jochen's answer explains, this sheetID is based on the order of the sheets in the spreadsheet.

提交回复
热议问题