Hello,
I was wondering if it is possible to have multiple onForm Submitted triggers contained within a single Google Sheet that run different functions based on which form is submitted.
E.g. I have two seperate GForms that add responses to a single Google Sheets file.
So, when user 1 completes Form A, Function 1 runs. Whereas when user 1 completes Form B, Function 2 runs. I don't want to have two seperate Google Sheets files where one runs Function1 on Form Submit and Function 2 runs on the other Google Sheet file when the form is submitted as I need the data collected from both forms to part of a bigger dataset that is contained within one file so other people can access and use it.
Any help would be greatly appreciated.
I did try the following code for the 2nd GForm within the same Google Sheet, but the result causes function 1 to run, instead of function 2.
//form 2
function secFormSubmit(){
var form = FormApp.openById('##########################');
ScriptApp.newTrigger('test')
.forForm(form)
.onFormSubmit()
.create();
}
//function 2
function test() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Active Leads");
sheet.getRange("I3").setValue("2nd Form");
}
Regards