const ss = SpreadsheetApp.getActiveSpreadsheet();
const leesBevestiging = ss.getSheetByName('target**');
const tempDataleesBevestiging = leesBevestiging.getRange(2, 1, leesBevestiging.getLastRow() -1, 2).getValues();
const emaillijst = ss.getSheetByName('emailLijst**');
const tempDataEML = emaillijst.getRange(2, 1,emaillijst.getLastRow(), 2).getValues();
let gelijk = [];
let dataLeesBevestiging = [];
let dataEML = [];
//concat names from first sheet and hold in an array
tempDataleesBevestiging.forEach((row) => {
dataLeesBevestiging.push(row[0] + row[1])
})
//concat names from second sheet and hold in an array
tempDataEML.forEach((row) => {
dataEML.push(row[0] + row[1])
});
//use the second sheet as your "guide" since it will be the sheet whose colors change
dataEML.forEach( (row, indx) => {
if (dataLeesBevestiging.indexOf(row) > -1) { //if the first sheet contains the name from the second sheet, get the index so we know which row to change color on
gelijk.push(indx +2) //add "2" to get row number since arrays start at 0, but sheet rows start at 1 and we skipped first row
}
})
gelijk.forEach( (row) => {
emaillijst.getRange(row,1,1,2).setBackground("#00cc66"); //or whatever color string
})
}