I have some code (at present just testing) that looks to match the values of one variable against another. It is within a For loop as it iterates through my Google Sheet. The loop is looking, bit the if statement doesn't seem to match items even when the values are the same. I have attached the following image to show both Image of code and Execution log and i have pasted the code itself below (as it is testing at present i am just watching what happens in the log). In the image you can see the first check should match but not the second, however both end up not matching. Can anyone help in identifying where i am going wrong?
function removeDuplicateEntry() {
var app = SpreadsheetApp;
// Get current active sheet
var activeSheet = app.getActiveSpreadsheet().getActiveSheet();
var lastRow = activeSheet.getLastRow();
var nEntry = Sheets.Spreadsheets.Values.get('1do7V_jx6T9XDWl1gSMvCyiIJdaI39qyQpw28t3CnOqo', 'E'+lastRow+':I'+lastRow);
for(var i=lastRow-1;i>1;i--){
var oEntry = Sheets.Spreadsheets.Values.get('1do7V_jx6T9XDWl1gSMvCyiIJdaI39qyQpw28t3CnOqo', 'E'+i+':I'+i);
if(oEntry.values === nEntry.values){
Logger.log(nEntry.values);
Logger.log(oEntry.values);
Logger.log("MATCH");
Logger.log(i);
//activeSheet.deleteRow(i);
} else {
Logger.log(nEntry.values);
Logger.log(oEntry.values);
Logger.log("NO MATCH");
Logger.log(i);
}
}
};
Kind reagrds,
John