Good afternoon,
I have this code that copies to sheet "INVOICE_ENTRY" any row in the range A5:P if it finds a value in column N.
"INVOICE_ENTRY" sheet is identical to the srcSheet, except it has a couple more columns after P.
What I want to happen is after running the script, if it finds a duplicate record in the dstSheet, and using columns G and H as the identifier, it overwrites the data in dstSheet, rather than adding a new row.
Is this possible?
Code:
Best regards,
manc
I have this code that copies to sheet "INVOICE_ENTRY" any row in the range A5:P if it finds a value in column N.
"INVOICE_ENTRY" sheet is identical to the srcSheet, except it has a couple more columns after P.
What I want to happen is after running the script, if it finds a duplicate record in the dstSheet, and using columns G and H as the identifier, it overwrites the data in dstSheet, rather than adding a new row.
Is this possible?
Code:
Code:
function payINVOICE() {
var ss = SpreadsheetApp.getActive();
var ds = SpreadsheetApp.openById("sheetname");
var srcSheet = ss.getSheetByName("PAY_INVOICE");
var dstSheet = ds.getSheetByName("INVOICE_ENTRY");
var data_range = srcSheet.getRange('A5:P');
var data_data = data_range.getValues();
var data_clean = data_data.filter(function (r) {return r[14]});
var clear_range = srcSheet.getRange('N5:P');
var lr = dstSheet.getLastRow();
dstSheet.getRange(lr+1, 2,data_clean.length,16).setValues(data_clean);
clear_range.clear();
}
Best regards,
manc