I am using the following code to move an entire row of data from one sheet to another, which works perfectly.
I am using AppSheet for users to access and edit the data which blocks the onEdit function in Sheets. AppSheet have suggested that I change this script to a "time based trigger" so that edits within the app have the same action as editing the column directly in "Sheets"
Is there a way to easily do this?
Thank you in advanced!
function onEdit(event) {
// assumes source data in sheet named Needed
// target sheet of move to named Acquired
// test column with yes/no is col 4 or D
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if(s.getName() == "Stock" && r.getColumn() == 14 && r.getValue() == "Booked") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Bookings");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);
}
}