Last active
April 1, 2021 14:52
-
-
Save crazy4groovy/82bada49c86a092e6b4d04ac25b65928 to your computer and use it in GitHub Desktop.
Read a public-readable Google Speadsheet as a CSV or JSON (JavaScript)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see: https://andregarzia.com/2018/11/reading-google-sheets-data-from-livecode.html | |
async function readSheet(key, sheetName = 'Sheet1', format = 'csv' /* 'json' */) { | |
const url = `https://docs.google.com/spreadsheets/d/${key}/gviz/tq?tqx=out:${format}&sheet=${sheetName}` | |
return fetch(url).then(r => r.text()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment