Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sendEmails() {
- var sheet = SpreadsheetApp.getActiveSheet();
- var startRow = 2; // First row of data to process
- var numRows = 3; // Number of rows to process
- // Fetch the range of cells A2:B2
- var dataRange = sheet.getRange(startRow, 1, numRows, 4);
- // Fetch values for each row in the Range.
- var dataRangee = sheet.getRange("D2");
- var date = dataRangee.getDisplayValues();
- var data = dataRange.getValues();
- for (i in data) {
- var row = data[i];
- var emailAddress = row[0]; // First column
- var subject = 'ILPA Request';
- var body = "Dear " + row[1] + "n nIn order to comply with statutory
- requirements";
- var file = DriveApp.getFileById('xxxx');
- var copy = row[2]; // Third column
- GmailApp.sendEmail(emailAddress, subject, body, {cc: copy, attachments:
- [file]});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement