Copy last row from one sheet to another depending on cell value with constant updates in master sheet
Solution 1:
Append data to Sheet EA if answer in colum1 is EA
function eA(e) {
const ss = SpreadsheetApp.getActive();
if (e.values[1] == "EA") {
ss.getSheetByName('EA').appendRow(e.values);
}
}
function createTrigger() {
if (ScriptApp.getProjectTriggers().filter(t => t.getHandlerFunction() == "eA").length == 0) {
ScriptApp.newTrigger("eA").forSpreadsheet(SpreadsheetApp.getActive()).onFormSubmit().create();
}
}
onFormSubmit Event Ojbect
If you want to learn more about the even object the add Logger.log(JSON.stringify(e))
near the beginning of the trigger handlerfunction.
Attempting to get the last row on a form submission is not a good idea because it triggers are comming at you very fast then you may actually be grabbing the wrong data. It's best to utilize the event object either values or namedValues.