https://docs.google.com/spreadsheets/d/1tf99kQdDSGxvj8f9B383W1NZRHRsd-b6bUcl9FJAOmQ/edit?usp=sharing
I want to send email from google sheets based on the criteria in column D and subject and messages choose as per criteria.I lost it in the line to choose the three different criteria(Yes,No,Confirm) and couldn't loop it.The email will be sent to different ids in sheet1 table.
How can i achieve this in google sheets scripts and how to send emails when new entry are made into the sheet?
Any solutions would be highly helpful for my project. Googlesheet newbie.
function checkValue(e)
{
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName(“Sheet1”);
var valueToCheck = sheet.getRange(“D2:D”).getValue();
var rangeEdit = e.range.getA1Notation();
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheet1=ss.getSheetByName('Sheet1');
var n=sheet1.getLastRow();
if(rangeEdit == “D2:D”)
{
if(valueToCheck = Yes )
{
function sendEmail() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheet1=ss.getSheetByName('Sheet1');
var n=sheet1.getLastRow();
for (var i = 2; i < n+1 ; i++ ) {
var emailAddress = sheet1.getRange(i,1).getValue();
var subject = sheet1.getRange(i,2).getValue();
var message = sheet1.getRange(i,3).getValue();
MailApp.sendEmail(emailAddress, subject, message);
}
}