I'm facing an issue in Google Sheets where I'm attempting to delete entire rows on the "Data" sheet if any value in column B matches values from the range D3:E20 in the "Backend" sheet. The code provided works when a word is hardcoded as the condition, but it doesn't seem to be functioning with the getValue range. I've tried looking at various solutions on different forums, however, they all involve specific words or phrases being hardcoded for deletion. Can anyone provide insights into what might be causing the issue with the code?
function deleteRows() {
var SS = SpreadsheetApp.openById('XXXXXXXXXXX');
var SHEET = SS.getSheetByName('Data');
var RANGE = SHEET.getDataRange();
var deletedata = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Backend').getRange("D3:E20");
var deleteValues = deletedata.getValues();
var COLUMN_TO_SEARCH = 1;
function deleteEachRow(){
var rangeValues = RANGE.getValues();
for(var i = rangeValues.length-1; i >= 0; i--){
if(rangeValues[i][COLUMN_TO_SEARCH] === deleteValues){
SHEET.deleteRow(i + 1);
}
};
};
};