Created
October 4, 2016 22:35
-
-
Save IanMulvany/bdfa75bc6fc895d363826295a7de2931 to your computer and use it in GitHub Desktop.
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 respondToFormSubmit(e) { | |
| var settings = PropertiesService.getDocumentProperties(); | |
| var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL); | |
| // Check if the actions of the trigger require authorizations that have not | |
| // been supplied yet -- if so, warn the active user via email (if possible). | |
| // This check is required when using triggers with add-ons to maintain | |
| // functional triggers. | |
| if (authInfo.getAuthorizationStatus() == | |
| ScriptApp.AuthorizationStatus.REQUIRED) { | |
| // Re-authorization is required. In this case, the user needs to be alerted | |
| // that they need to reauthorize; the normal trigger action is not | |
| // conducted, since authorization needs to be provided first. Send at | |
| // most one 'Authorization Required' email a day, to avoid spamming users | |
| // of the add-on. | |
| sendReauthorizationRequest(); | |
| } else { | |
| Logger.log("responded to form submit"); | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var sheet = ss.getSheets()[0]; | |
| var values = sheet.getDataRange().getValues() | |
| Logger.log(values.length) | |
| for(n=1;n<values.length+1;++n){ | |
| // var cell = values[n][3] ; // x is the index of the column starting from 0 | |
| var coordinate = "G" + n; | |
| Logger.log(coordinate); | |
| var cell = sheet.getRange(coordinate); | |
| var formulat_string = '=CONCATENATE(B' + n + '," ",' + 'C' + n + ')'; | |
| cell.setFormula(formulat_string); | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment