Skip to content

Instantly share code, notes, and snippets.

@robroc
Created June 10, 2013 15:37
Show Gist options
  • Save robroc/5749735 to your computer and use it in GitHub Desktop.
Save robroc/5749735 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
// Assign Google spreadsheet URL to variable
var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?key=0ArP8859PKYs8dEpUQ3hLejA1TVo1cWxPbnBVNy11TGc&output=html';
$(document).ready( function() {
// Initialize Tabletop with whatever options you want
Tabletop.init( { key: public_spreadsheet_url,
callback: showInfo,
simpleSheet: true
});
// Compile Handlebars template
function showInfo(data, tabletop) {
var source = $("#handlebars-template").html();
var template = Handlebars.compile(source);
// Create a templated item for every row in the spreadsheet
$.each( tabletop.sheets("profiles").all(), function(i, cat) {
var html = template(cat);
$("#content").append(html);
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment