Skip to content

Instantly share code, notes, and snippets.

@mattash
mattash / gist:7269866
Created November 1, 2013 18:40
Google Spreadsheet AppScript that publishes JSON of a Sum
function getTickets() {
var sheet = SpreadsheetApp.openById("SPREADSHEET_ID").getSheetByName("SHEET_NAME_WITH_SUM");
var count = sheet.getRange("LOCATION_OF_CELL");
return count.getValue();
}
function doGet() {
var result = {
"TITLE_OF_SUM":this.getTickets()
function doGet(request) {
var output = ContentService.createTextOutput();
var data = {};
var id = "ID";
var sheet = "SHEETNAME";
var ss = SpreadsheetApp.openById(id);
if (sheet) {
data = readData_(ss, sheet);
}
output.setContent(JSON.stringify(data));