Read data from Google SpreadSheed with few lines of code
Created
October 7, 2013 13:41
-
-
Save abusedmedia/6868236 to your computer and use it in GitHub Desktop.
Read data from Google SpreadSheed with few lines of code
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta name="description" content="TableTop simple example" /> | |
<meta charset="utf-8"> | |
<title>Tabletop.js test</title> | |
<script type="text/javascript" src="https://rawgithub.com/jsoma/tabletop/master/src/tabletop.js"></script> | |
</head> | |
<body> | |
<p>NOTE: You must have singed-in with your Google account in order to let the tabletop works.</p> | |
<div id="cont"></div> | |
</body> | |
</html> |
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
window.onload = function(){ | |
var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AmYzu_s7QHsmdDNZUzRlYldnWTZCLXdrMXlYQzVxSFE&output=html'; | |
Tabletop.init({ | |
key: public_spreadsheet_url, | |
callback: showInfo, | |
simpleSheet: true | |
}); | |
function showInfo(data){ | |
console.log(data); | |
var cont = document.getElementById('cont'); | |
for(var i=0; i<data.length; ++i){ | |
cont.insertAdjacentHTML('beforebegin', '<p>'+data[i].category+'</p>'); | |
} | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment