Skip to content

Instantly share code, notes, and snippets.

@rheajt
Last active August 30, 2021 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rheajt/ee5a1ab2afec08ca07f60dd885b54c63 to your computer and use it in GitHub Desktop.
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
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();
@elidickinson
Copy link

This API doesn't work any more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment