SHARE
TWEET

Untitled

a guest Jun 25th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sendEmails() {
  2. var sheet = SpreadsheetApp.getActiveSheet();
  3. var startRow = 2; // First row of data to process
  4. var numRows = 3; // Number of rows to process
  5. // Fetch the range of cells A2:B2
  6. var dataRange = sheet.getRange(startRow, 1, numRows, 4);
  7. // Fetch values for each row in the Range.
  8. var dataRangee = sheet.getRange("D2");
  9. var date = dataRangee.getDisplayValues();
  10. var data = dataRange.getValues();
  11. for (i in data) {
  12. var row = data[i];
  13. var emailAddress = row[0]; // First column
  14. var subject = 'ILPA Request';
  15. var body = "Dear " + row[1] +   "n nIn order to comply with statutory
  16. requirements";
  17. var file = DriveApp.getFileById('xxxx');
  18. var copy = row[2]; // Third column
  19.  
  20. GmailApp.sendEmail(emailAddress, subject, body, {cc: copy, attachments:
  21. [file]});
  22. }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top