I am currently struggling to write a program that automaticaly sends out an email when the value of a cell changes from 0 to 1, and cant seem to get it to work.
I want it to read the value of a specific cell on edit, see if the cells value has changed, then run an automated email send. I keep getting
TypeError: Cannot read properties of undefined (reading ‘range’).
onEdit (e)
const specificSheet = "SHEET" // for example
const specificCell = "CELL" // for example
let sheetCheck = (e.range.getSheet().getName() == specificSheet)
let cellCheck = (e.range.getA1Notation() == specificCell)
if (!(sheetCheck && cellCheck)) {
return
}
else {
function sendText() {
var EmailTo = "EMAIL A";
var EmailTo = "EMAIL B";
var subject = "Automated Spreadsheet Access Bot";
var body = "TEXT";
MailApp.sendEmail(EmailTo, subject, body);
}
}
New contributor
Ora Mortis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.