function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 2000; // Number of rows to process
// Fetch the range of cells A2:B3
var dataRange = sheet.getRange(startRow, 1, numRows, 2)
// 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 = row[1]; // Second column
var subject = "Sending emails from a Spreadsheet";
MailApp.sendEmail(emailAddress, subject, message, {noReply:true});
}
}
Here I want to send C2, D2, E2, F2 row-wise data to A2 and C3, D3, E3, F3 row-wise data to A3 and the loop should run for all the rows in the sheet.
I have a script send the common subject body to everyone.
But this script is not helping to resolve my issue.
Could someone please help me with sending data in the mentioned pattern
data. Yourmessagevariable then contains the content of column B, which is empty. Can you describe further what exactly the content of the emails should be based on your example spreadsheet?