The case is I have a google sheet, that has a column that gets edited and 3 columns next to it that include a check, an email body and an email subject. I made the following code so that when a certain cell is edited in the edit column, an email is sent for notification. I put the email in a column that is referred to in the code.
function onEdit(e){
//Detecting the edited cell and fetching the values from the other columns
var range = e.range;
var check = range.offset(0,2).getValue()
var serial = range.offset(0,-1).getValue()
var email = range.offset(0,-8).getValue()
var message = range.offset(0,3).getValue()
var subject = range.offset(0,4).getValue()
if (check == "SendEmail") { var email2 = email; }
//Checks to see if the code is running
SpreadsheetApp.getActiveSpreadsheet().getRange('R1').setValue(email2)
SpreadsheetApp.getActiveSpreadsheet().getRange('S1').setValue(check)
//Email part
var emailAddress = email2;
MailApp.sendEmail(emailAddress, subject, message)
}
When I try using the function without the on edit feat, the email is sent. when I, however, put the onEdit back on, it works perfectly still but no emails are sent.