Issue:
I have a simple action that is required every time a new entry is added to my Google Sheets "Sales Form Reponses" page. The code for running it manually when I know this is needed, works perfectly well, and simply adds a new row to the sheet "Sales Data Clean", and copies all the formulas from the previous row. This is necessary because it adds some fields of information to the form entries.
function addRow() {
var ss = SpreadsheetApp.getActive();
var sh = ss.getSheetByName('Sales Data Clean'), lRow = sh.getLastRow();
var lCol = sh.getLastColumn(), range = sh.getRange(lRow,1,1,lCol);
sh.insertRowsAfter(lRow, 1);
range.copyTo(sh.getRange(lRow+1, 1, 1, lCol), {contentsOnly:false});
}
I am trying to use a trigger to make Google Sheets run this function whenever a new form entry is submitted.
Problem:
I have two forms linked to the overall Google Sheets document. The other sheet affected is called "Stock Form Responses", and the trigger won't allow to specify that the function AddRow should ONLY run if the Sales Form has a new entry. How do I do this? Help greatly appreciated.