Skip to content

Instantly share code, notes, and snippets.

@mfyz
Last active April 10, 2020 05:08
Show Gist options
  • Save mfyz/b2750ddfb571e259f604ed8790d7fa96 to your computer and use it in GitHub Desktop.
Save mfyz/b2750ddfb571e259f604ed8790d7fa96 to your computer and use it in GitHub Desktop.
Access Google Sheet via Public JSON

Publish the document to web publicy

Make sure select "automatically republish when content changes" in advanced

https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values?alt=json-in-script

This will give a JSON object like:

gdata.io.handleScriptLoaded(
   {
      "version":"1.0",
      "encoding":"UTF-8",
      "feed":{
         "xmlns":"http://www.w3.org/2005/Atom",
         "xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/",
         "xmlns$batch":"http://schemas.google.com/gdata/batch",
         "xmlns$gs":"http://schemas.google.com/spreadsheets/2006",
         "id":{
            "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values"
         },
         "updated":{
            "$t":"2020-04-10T04:41:55.735Z"
         },
         "category":[
            {
               "scheme":"http://schemas.google.com/spreadsheets/2006",
               "term":"http://schemas.google.com/spreadsheets/2006#cell"
            }
         ],
         "title":{
            "type":"text",
            "$t":"Sheet1"
         },
         "link":[
            {
               "rel":"alternate",
               "type":"application/atom+xml",
               "href":"https://docs.google.com/spreadsheets/u/0/d/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/pubhtml"
            },
            {
               "rel":"http://schemas.google.com/g/2005#feed",
               "type":"application/atom+xml",
               "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values"
            },
            {
               "rel":"http://schemas.google.com/g/2005#post",
               "type":"application/atom+xml",
               "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values"
            },
            {
               "rel":"http://schemas.google.com/g/2005#batch",
               "type":"application/atom+xml",
               "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/batch"
            },
            {
               "rel":"self",
               "type":"application/atom+xml",
               "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values?alt=json-in-script"
            }
         ],
         "author":[
            {
               "name":{
                  "$t":"fatih.mfyz"
               },
               "email":{
                  "$t":"[email protected]"
               }
            }
         ],
         "openSearch$totalResults":{
            "$t":"10"
         },
         "openSearch$startIndex":{
            "$t":"1"
         },
         "gs$rowCount":{
            "$t":"1000"
         },
         "gs$colCount":{
            "$t":"26"
         },
         "entry":[
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R1C1"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"A1"
               },
               "content":{
                  "type":"text",
                  "$t":"Testing 1"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R1C1"
                  }
               ],
               "gs$cell":{
                  "row":"1",
                  "col":"1",
                  "$t":"Testing 1"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R1C2"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"B1"
               },
               "content":{
                  "type":"text",
                  "$t":"Description line 1"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R1C2"
                  }
               ],
               "gs$cell":{
                  "row":"1",
                  "col":"2",
                  "$t":"Description line 1"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R2C1"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"A2"
               },
               "content":{
                  "type":"text",
                  "$t":"Testing 2"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R2C1"
                  }
               ],
               "gs$cell":{
                  "row":"2",
                  "col":"1",
                  "$t":"Testing 2"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R2C2"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"B2"
               },
               "content":{
                  "type":"text",
                  "$t":"Description line 2"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R2C2"
                  }
               ],
               "gs$cell":{
                  "row":"2",
                  "col":"2",
                  "$t":"Description line 2"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R3C1"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"A3"
               },
               "content":{
                  "type":"text",
                  "$t":"Testing 3"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R3C1"
                  }
               ],
               "gs$cell":{
                  "row":"3",
                  "col":"1",
                  "$t":"Testing 3"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R3C2"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"B3"
               },
               "content":{
                  "type":"text",
                  "$t":"Description line 3"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R3C2"
                  }
               ],
               "gs$cell":{
                  "row":"3",
                  "col":"2",
                  "$t":"Description line 3"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R4C1"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"A4"
               },
               "content":{
                  "type":"text",
                  "$t":"Testing 4"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R4C1"
                  }
               ],
               "gs$cell":{
                  "row":"4",
                  "col":"1",
                  "$t":"Testing 4"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R4C2"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"B4"
               },
               "content":{
                  "type":"text",
                  "$t":"Description line 4"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R4C2"
                  }
               ],
               "gs$cell":{
                  "row":"4",
                  "col":"2",
                  "$t":"Description line 4"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R5C1"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"A5"
               },
               "content":{
                  "type":"text",
                  "$t":"Testing 5"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R5C1"
                  }
               ],
               "gs$cell":{
                  "row":"5",
                  "col":"1",
                  "$t":"Testing 5"
               }
            },
            {
               "id":{
                  "$t":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R5C2"
               },
               "updated":{
                  "$t":"2020-04-10T04:41:55.735Z"
               },
               "category":[
                  {
                     "scheme":"http://schemas.google.com/spreadsheets/2006",
                     "term":"http://schemas.google.com/spreadsheets/2006#cell"
                  }
               ],
               "title":{
                  "type":"text",
                  "$t":"B5"
               },
               "content":{
                  "type":"text",
                  "$t":"Description line 5"
               },
               "link":[
                  {
                     "rel":"self",
                     "type":"application/atom+xml",
                     "href":"https://spreadsheets.google.com/feeds/cells/1ZmdmQm3sVlGcUpiQBOd9JRFCSQJ5_HLeUjUXfvNic_I/1/public/values/R5C2"
                  }
               ],
               "gs$cell":{
                  "row":"5",
                  "col":"2",
                  "$t":"Description line 5"
               }
            }
         ]
      }
   }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment