nyc-bookstores/node_modules/tabletop/examples/simple/simple.html
2013-05-27 13:45:59 -07:00

30 lines
1.1 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<body>
<p id="food"></p>
<script type="text/javascript" src="../../src/tabletop.js"></script>
<script type="text/javascript">
window.onload = function() { init() };
var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AmYzu_s7QHsmdDNZUzRlYldnWTZCLXdrMXlYQzVxSFE&output=html';
function init() {
Tabletop.init( { key: public_spreadsheet_url,
callback: showInfo,
simpleSheet: true } );
}
function showInfo(data) {
// data comes through as a simple array since simpleSheet is turned on
alert("Successfully processed " + data.length + " rows!")
document.getElementById("food").innerHTML = "<strong>Foods:</strong> " + [ data[0].name, data[1].name, data[2].name ].join(", ");
console.log(data);
}
document.write("The published spreadsheet is located at <a target='_new' href='" + public_spreadsheet_url + "'>" + public_spreadsheet_url + "</a>");
</script>
</body>
</html>