- Publish your sheet to the web
- Use the url: https://spreadsheets.google.com/feeds/cells/<<SS_ID>>/1/public/full?alt=json
- Fetch the data in Codepen
- Render the cells to the page
Last active
August 30, 2021 21:24
-
-
Save rheajt/ee5a1ab2afec08ca07f60dd885b54c63 to your computer and use it in GitHub Desktop.
[Publish Google Sheet to the Web] easily turn your google sheets into a JSON data source #gaspowered
This file contains hidden or 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
<ul></ul> |
This file contains hidden or 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
const ul = document.querySelector('ul'); | |
async function getCells() { | |
const response = await fetch('https://spreadsheets.google.com/feeds/cells/1KF03q656HEwFfrOjgLAsYUA1eAHfbVSXoFWegYzJZJ8/1/public/full?alt=json'); | |
const json = await response.json(); | |
return json.feed.entry; | |
} | |
async function onLoad() { | |
const data = await getCells(); | |
const cells = data | |
.filter(each => +each.gs$cell.col >= 3 && +each.gs$cell.row >= 2) | |
.map(entry => `<li>${entry.gs$cell.inputValue}</li>`); | |
ul.innerHTML = cells.join(''); | |
} | |
onLoad(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This API doesn't work any more