I found a few very helpful sites and videos helping with this; however I 
can't find something a little more specific to what I would like to do.

This is the code that I have so far ...

function sendemail() {

  var techblog_samplesheet = SpreadsheetApp.getActiveSheet() , first_row_no 
= 2, total_no_rows = 26 ;
  var getdata =  techblog_samplesheet.getRange(first_row_no, 1, 
total_no_rows, 3)
  var sample_data = getdata.getValues();
  for (i in sample_data) {
    var row = sample_data[i];
    var email = row[22];
    var message = "Dear " + row[17] + " and " + row[18];
    var subject = "Updated information";
    MailApp.sendEmail(email, subject, message);
  }
}

What I'm trying to do is this - 

row[18] doesn't always have a name, and I don't want the email to say "Dear 
X and".  How can I only have it output "Dear X" when row[18] is blank and 
Dear X and X" when there is data in row[18]?

Reply via email to