Skip to content

Instantly share code, notes, and snippets.

@motyar
Created September 5, 2021 16:24
Show Gist options
  • Save motyar/d03bf01212d0968ae48c752adc1440d6 to your computer and use it in GitHub Desktop.
Save motyar/d03bf01212d0968ae48c752adc1440d6 to your computer and use it in GitHub Desktop.
Google sheet to JSON link and accessing that data with JavaScript
const spreadsheetId = '1bPt3cGhnfvqASOmcpvBQglPqg_fnU6aZktlYA8gqEdw'
fetch(`https://docs.google.com/spreadsheets/d/${spreadsheetId}/gviz/tq?tqx=out:json`)
.then(res => res.text())
.then(text => {
const json = JSON.parse(text.substr(47).slice(0, -2));
console.log(json);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment