I have two google separate forms that submit new client data to two separate spreadsheets. How would I use the onFormSubmit() on two separate spreadsheet sources in one app script editor? thank you all very much :D
if this is getting one sheet how could it implement two or more? i think i get SpreadsheetApp.getSheetByName('xyz'); and im a little unsure exactly what an active sheet is or activated I think it is the sheet you're currently on in the spreadsheet the dev app script is being derived from. I might be missing some other basic concepts
function onFormSubmit(){
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sht = ss.getSheetByName('New Client Submission Form (Phone)'&&'New Client Submission Form (Emailed)')
var activeRng = sht.getRange("A2:K2")
var values = activeRng.getValues()
var height = values.length
var width = values[0].length
var ss_dest = SpreadsheetApp.openById('1wgzUSXFNLFQz6tv42Cp_o94qRPAB9IkZnKP5tGL003o')
var sht_dest = ss_dest.getSheetByName('Estimate Compiler')
var destRange = sht_dest.getRange(2,1,height,width)
destRange.setValues(values)
}
this function does exatly as expected I just don't know how to implement two or more yet
e.range.getSheet()to determine which linked sheets they were going to and thus which form that they came from. - Cooperfunction onFormSubmit(e) { var formObj={LinkedSheet1:FormName1,LinkedSheet2:FormName2}; var form=formObj[e.range.getSheet().getName()]; }- Cooper