Last active
April 7, 2016 07:07
-
-
Save DominicBreuker/ae21d9516cff41b5cac1f8114e09415b to your computer and use it in GitHub Desktop.
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
function doPost(e) { | |
try { | |
var newRow = createNewRowAndWriteToSheet(e.parameter); | |
return JsonFormattedSuccess(newRow.toString()); | |
} catch(error) { | |
return JsonFormattedError(error) | |
} | |
} | |
function JsonFormattedSuccess(success_message) { | |
return JsonResponse(JSON.stringify({"result":"success", "row": success_message})); | |
} | |
function JsonFormattedError(error_message) { | |
return JsonResponse(JSON.stringify({"result":"error", "error": error_message})); | |
} | |
function JsonResponse(message) { | |
return ContentService.createTextOutput(message).setMimeType(ContentService.MimeType.JSON); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment