ביקשתי מצאט GPT סקריפט שכל פעם שאני ישנה באחד התאים בעמודה מסויימת בתפריט נפתח
זה ישלח לי מייל
הוא הביא לי את הקוד הבא
אבל בפועל זה מחזיר לי את השגיאה הבאה
TypeError: Cannot read properties of undefined (reading 'source')
onEdit
@ קוד.gs:2
יש למשהו מושג?
זה ישלח לי מייל
הוא הביא לי את הקוד הבא
function onEdit(e) {
var sheet = e.source.getActiveSheet();
var range = e.range;
// Check if the edited cell is in column D and has a value of "For Immediate Execution"
if (range.getColumn() == 4 && range.getValue() == "For Immediate Execution") {
// Get the email address of the recipient
var recipient = "<לא ניתן לפרסם מיילים באופן פומבי>";
// Get the current date and time
var date = new Date();
// Compose the email message
var subject = "Immediate Action Required";
var body = "Hello,\n\nThis is an automated message from Google Sheets. " +
"The dropdown menu in cell " + range.getA1Notation() + " was changed to " +
range.getValue() + " on " + date.toLocaleString() + ".\n\n" +
"Please take immediate action.";
// Send the email
MailApp.sendEmail(recipient, subject, body);
// Change the background color of the cell to red
range.setBackground("red");
}
}
אבל בפועל זה מחזיר לי את השגיאה הבאה
TypeError: Cannot read properties of undefined (reading 'source')
onEdit
@ קוד.gs:2
יש למשהו מושג?