-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.gs
28 lines (26 loc) · 830 Bytes
/
setup.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/** PREREQUISITE TO FUNCTIONALITY
*
* 1) Ensure "writeSheetId" & "masterFormId" is defined in
* File > Project properties > Script properties
* 2) Run > Run function > triggerSetUp
* 3) Grant necessary permissions for program to run.
*
*/
var scriptProperties = PropertiesService.getScriptProperties();
/**
* Establishes the link between the master form and this script.
*/
function triggerSetUp() {
if (!(scriptProperties.getProperty("writeSheetId"))) {
throw new Error("writeSheetId is not defined in script properties.");
}
var formId = scriptProperties.getProperty("masterFormId");
if (formId) {
ScriptApp.newTrigger("onFormSubmit")
.forForm(formId)
.onFormSubmit()
.create();
} else {
throw new Error("masterFormId is not defined in script properties.");
}
}