I need to sent an e-mail to a group of people. Therefor I have a list of e-mailadresses set up in Spreadsheet, the Sheetname = Contacts.
The Weeknr-sheet is used to generate the required weeknumber in the subject.
I want to send this e-mail to everyone using the BCC, but I don't want to place all the e-mailadresses in the code itself (almost every solution gives that option), but extract them from the sheet.
My current code:
function sendEmail() {
var originalSpreadsheet = SpreadsheetApp.getActive();
var Weeknr = originalSpreadsheet.getSheetByName("Weeknr");
var period = Weeknr.getRange("C2").getValues();
var contacts = originalSpreadsheet.getSheetByName("Contacts");
var emailTo = contacts.getRange("A2:A500").getValues();
{
var subject = " SUBJECT " + period;
var message = " MESSAGE ";
MailApp.sendEmail(emailTo, subject, message);
}
}