I have a Google spreadsheet called Product Request Form (Responses) with three sheets labelled Form Responses, Clifford and Jim. In the Form Responses sheet there are three columns: timestamp, ProductArtist and ProductLabel.
I'd like the whole row to be moved/cut to either Clifford or Jim sheet based on the cell value under ProductLabel. E.g. If the cell value is Warner I'd like the row moved to Clifford, if the cell value is Universal I'd like that row moved to Jim.
It would also be extermley handy to have them moved as soon as the sheet Form Responses is populated upon someone completing the form.
function onEdit(event) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if(s.getName() == "Form Responses" && r.getColumn() == 6 && r.getValue() == "Warner") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Clifford");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);
}
}
I'm still finding it difficult to understand how to write the "on form submit" script. I've managed to find a similar script which works when the cell value is edited however it doesn't work when a row is created on the submission of the form.