My main goal here is to run a lookup for each cell based on the value in column b from another Google sheet and if there are multiple entries return whether there is a match or not. Eg look up the occupant on the application and check to see if it matches information held on the "data base"
I have tweaked the above script which returns the first value almost like a Vlookup (the cell ranges aren't dynamic either) however I am only just learning Javascript and cant work out what is needed to achieve the desired result here.
Any help would be appreciated as I am keen to learn.
function CtLookups() {
var s = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = SpreadsheetApp.openById('1OZ-oNcx-ZeDqNpxthzH7lxbPZUR88WJC3wmfvHx-yHc').getSheetByName("Report 1").getRange('A:B').getValues()
var searchValue = s.getRange("B3").getValue();
var dataList = data.map(x => x[0])
var index = dataList.indexOf(searchValue);
if (index === -1) {
throw new Error('Value not found')
} else {
var foundValue = data[index][1]
s.getRange("D3").setValue(foundValue);
}
}



