function copyRejected() {
const ss=SpreadsheetApp.getActive();
const sh2=ss.getSheetByName('Sheet2');
const sh1=ss.getSheetByName('RENTERS');
const sr1=3;
const rg1=sh1.getRange(sr1,1,sh1.getLastRow()-sr1+1,sh1.getLastColumn());
const v1=rg1.getValues();
var d=0;
v1.forEach(function(r,i){
if(r[0]=='Rejected') {
sh2.appendRow(r);
//sh2.deleteRow(i+sr-d++);//If you wish to delete the copied rows from sh1 then remove forward slashes at the beginning of this line.
}
});
}
Если вы не включили V8, измените все константы на var.
Sheet1:
Sheet2:
Справочник по приложениям Script