0

Using Postman, with calls such as GET https://spreadsheets.google.com/feeds/list/1XJgmvAGNmpyJieZTh40PuoKHoKOI1CJlMqSStu75fWo/od6/public/basic?alt=json&range=(A1:F101).getValue()

I get a JSON feed with xml schema, eg { "version": "1.0", "encoding": "UTF-8", "feed": { "xmlns": "http://www.w3.org/2005/Atom", "xmlns$openSearch": "http://a9.com/-/spec/opensearchrss/1.0/", "xmlns$gsx": "http://schemas.google.com/spreadsheets/2006/extended", "id": { "$t": "https://spreadsheets.google.com/feeds/list/1XJgmvAGNmpyJieZTh40PuoKHoKOI1CJlMqSStu75fWo/od6/public/basic" }, "updated": { "$t": "2020-02-27T00:58:42.663Z" }, "category": [ { "scheme": "http://schemas.google.com/spreadsheets/2006", "term": "http://schemas.google.com/spreadsheets/2006#list".

I only want the data in the sheet.

What inline script do I use to get a range of data eg A1:C6

OR all data (only)

Thanks in advance

JPV
  • 26,499
  • 4
  • 33
  • 48
  • Does this answer your question? [Download link for Google Spreadsheets CSV export - with Multiple Sheets](https://stackoverflow.com/questions/33713084/download-link-for-google-spreadsheets-csv-export-with-multiple-sheets) – TheMaster Feb 27 '20 at 11:58

1 Answers1

1

Question

How to get data values from Spreadsheet with GET request?

Answer

Use this format:

https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID/values/RANGE?majorDimension=COLUMNS&key=YOUR_API_KEY

So finally it should look like this:

https://sheets.googleapis.com/v4/spreadsheets/1XJgmvAGNmpyJieZTh40PuoKHoKOI1CJlMqSStu75fWo/values/A1:F101?majorDimension=COLUMNS&key=[YOUR_API_KEY]

Try API Explorer so you can adapt it to your needs

The response is:

{
  "range": "Sheet1!A1:C21",
  "majorDimension": "COLUMNS",
  "values": [
    [
      "a1",
      "a2",
...
      "c19",
      "c20",
      "c21"
    ]
  ]
}

And now it is time to format it with forEach or whatever you like.

Jeff Rush
  • 874
  • 6
  • 13