Skip to content

Instantly share code, notes, and snippets.

@jlord
Created September 21, 2024 20:44
Show Gist options
  • Save jlord/2f7605c6b72e54383ea9d12d8e274931 to your computer and use it in GitHub Desktop.
Save jlord/2f7605c6b72e54383ea9d12d8e274931 to your computer and use it in GitHub Desktop.
Spreadsheet thing
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2021 Books JSON</title>
</head>
<body>
<pre><code id="resultsContainer"></code></pre>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.1.0/papaparse.min.js"></script>
<script type="text/javascript">
// This example from:
// https://github.com/jsoma/tabletop/blob/master/examples/simple/no-tabletop.html
// https://docs.google.com/spreadsheets/d/e/2PACX-1vQmyMzKlRAic_VqHO7B1LSunLxx8X5BPSI2Yz1Nw31l9ut8-CHkpfL3DK4IXX6f0e1lZOYoJitYzGpo/pub?gid=0&single=true&output=csv
var public_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQmyMzKlRAic_VqHO7B1LSunLxx8X5BPSI2Yz1Nw31l9ut8-CHkpfL3DK4IXX6f0e1lZOYoJitYzGpo/pub?output=csv';
// 2021: https://docs.google.com/spreadsheets/d/e/2PACX-1vQmyMzKlRAic_VqHO7B1LSunLxx8X5BPSI2Yz1Nw31l9ut8-CHkpfL3DK4IXX6f0e1lZOYoJitYzGpo/pub?output=csv
function init() {
Papa.parse(public_spreadsheet_url, {
download: true,
header: true,
complete: showInfo
})
}
window.addEventListener('DOMContentLoaded', init)
function showInfo(results) {
var data = results.data
var dataFormatted = results.data.toString()
console.log("Daataaa", JSON.stringify(data, null, ' '))
document.getElementById("resultsContainer").innerHTML = JSON.stringify(data, null, ' ');
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment