very new to app script but well versed in formulas and so up-skilling.
For reference I've made a test sheet HERE
My script has been a Frankenstein of tutorials but essentially I'm trying to match the name and date from sheet 2 to the data in sheet 1 and if they match then in column "C" I'd like to setValue as "sent"
Here is what I've tried so far:
function sendReport() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var clientName = ss.getRange ("Sheet2!B1");
var testDate = ss.getRange ("Sheet2!B2")
var destSheet = ss.getSheetByName("Sheet1");
var range = destSheet.getDataRange();
var values = range.getValues();
for(var i = 1; i < values.length; i++){
if (values[i][1] == clientName
&& values[i][2] == testDate) {
values[i][3] = Yes;
}
range.setValues(values)
}
The actual sheet is quite large and it seems to go through each row at a time checking as the script takes a long time to run but then it's not adding the "Yes" value into the column to confirm the report has been sent.
Would really appreciate any help.



