Last active
July 5, 2020 04:52
-
-
Save saamerm/0bb0fd0cafc80adb25ddc5d9a6b65a1e to your computer and use it in GitHub Desktop.
Google Apps Script code to accept feedback from Xamarin iOS & Android apps
This file contains hidden or 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(request){ | |
| // Open Google Sheet using ID | |
| var sheet = SpreadsheetApp.openById("{SheetID}"); | |
| var result = {"Status": "SUCCESS", "Message": "Thank you for your feedback"}; | |
| try{ | |
| // Convert post data content to a JS object | |
| var resultObject = JSON.parse(request.postData.contents) | |
| // Append data on Google Sheet | |
| var rowData = sheet.appendRow([resultObject.Name, resultObject.Email, resultObject.Phone, resultObject.Feedback]); | |
| }catch(exc){ | |
| // If error occurs, throw exception | |
| result = {"Status": "FAILED", "Message": exc}; | |
| } | |
| // Return result | |
| return ContentService | |
| .createTextOutput(JSON.stringify(result)) | |
| .setMimeType(ContentService.MimeType.JSON); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment