Hi, I'm trying to implement the email scheduler script as per:
https://developers.google.com/apps-s...sending_emails
can I please ask for help with a few modifications?
it currently is looking 100 rows down (changed from 2 in the original version)
the issue is that it returns an error related to MailApp.sendEmail(emailAddress, subject, message);
emails are being received but this error fires off because there are blank spaces in the Sheet UNDER the initial top 2 emails. Blank spaces below them are unavoidable because the data is always changing so 100 rows changed in a script is taking this into consideration.
MOD #1: a script is to ignore all blanks so no error message is returned. can it ignore even the spaces in between the contacts and still fire off properly?
MOD #2: is there a way to add SEND FROM NAME field? currently, it shows the email address
I'm not a coder, would greatly greatly appreciate the edits in the actual script which I'm pasting below. please?
a link to the actual files if needed is also below.
thanking you much in advance.
https://docs.google.com/spreadsheets...it?usp=sharing
/**
* Sends emails with data from the current spreadsheet.
*/
function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 100; // Number of rows to process
// Fetch the range of cells A2:B3
var dataRange = sheet.getRange(startRow, 1, numRows, 3);
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (var i in data) {
var row = data[i];
var emailAddress = row[0]; // First column
var message = row[1]; // Second column
var subject = row[2]; // Third column
MailApp.sendEmail(emailAddress, subject, message);
}
}
-----
ERROR IMAGE
https://www.excelforum.com/attachmen...1&d=1626031113
Bookmarks