Skip to content

Instantly share code, notes, and snippets.

@erinlin
Created June 19, 2013 14:24
Show Gist options
  • Save erinlin/5814707 to your computer and use it in GitHub Desktop.
Save erinlin/5814707 to your computer and use it in GitHub Desktop.
google apps script - Serve Google Spreadsheet as JSONP
//http://me.dt.in.th/page/SpreadsheetToJSONP
function onEdit(e) {
var value = SpreadsheetApp.getActiveSpreadsheet().getSheets()
.filter(function(sheet) { return sheet.getName() != "JS" })
.map(function(sheet) {
return { name: sheet.getName(),
values: sheet.getDataRange().getValues() };
});
SpreadsheetApp.getActiveSpreadsheet()
.getSheetByName("JS").getRange("B1").setValue(JSON.stringify(value));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment