Please help me with the below: Starting from row 7 of sheet1: if column E is NOT BLANK and column D is BLANK then I need copy from columns A:L to last empty row of sheet2
I believe your goal as follows.
I this case, how about the following sample script?
function myFunction() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet1 = ss.getSheetByName("Sheet1");
const sheet2 = ss.getSheetByName("Sheet2");
const values = sheet1.getRange("A7:L" + sheet1.getLastRow()).getValues().reduce((ar, r) => {
if (r[3].toString() == "" && r[4].toString() != "") ar.push(r);
return ar;
}, []);
sheet2.getRange(sheet2.getLastRow() + 1, 1, values.length, values[0].length).setValues(values);
}