I am trying to complete the script to send an email for any edit of a specific tab on a google sheet, but i keeps giving me this error:
TypeError: Cannot read properties of undefined (reading 'range')
My script is:
function sendEditNotification(e){
if (e.range.columnStart != 6 || e.value != "Checked in") return;
const rData = e.source.getActiveSheet().getSheetByName("Daily PSP List").getRange().getValues();
let Names = rData[1][3];
let Email = "Chris.DonovanBayley@swale.at";
let Year = rData[1][3];
let Duration = rData[3][3];
let msg = "Hi, " + Names + " has been marked " + CurrentStatus
MailApp.sendEmail(email, "PSP attendance", msg)
sheet format. enter image description here
Is anyone able to educate me as to what I have got wrong please and help? Thank you in advance.
Help to correct the script.