My emails include a range from my Google Sheet. The email body looks like this now with comma's in between all the names in one loge sentence:
Tom,Willaims,Terry,Lord,Jack,Masters
The A column has the first name the B column has the last name.
I don't know how to format the sheet range
function SendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 1; // Number of rows to process
// Fetch the range of cells A2
var dataRange = sheet.getRange(startRow, 1, numRows, 1);
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (i in data) {
var row = data[i];
var emailAddress = row[0]; // First column
var message = sheet.getRange("Sheet1!A19:B21").getValues();
var subject = 'Your Current Bus Roster';
MailApp.sendEmail(emailAddress, subject, message);
}
}
The body of the email should look like a data table: Tom Willaims