Pages

Friday, 27 September 2019

Bulk send emails from Google Sheet

The following Google Apps Script is designed to loop through each row of a Google Sheet and send an email containing information from it. This means you can send personalised emails with ad-hoc information for each recipient quickly.
Screenshot of spreadsheet data used for creating emails
Screenshot of spreadsheet data used for creating emails

It has been developed so that it is easily expandable for you to add further columns/rows. The script has a number of features to achieve this:
  1. A menu option for easily selecting to send email, with a confirmation dialogue popup.
  2. A timestamp as confirmation for when an email was sent.
  3. A check that an Email Address is present and there is no current value in the Email Sent column - to prevent repeat email sending but also allow ad-hoc emailing by clearing this column for those you wish to send again.
  4. A try/catch to help automatically deal with problematic emails that may break the script - an error message will be written into the Email Sent column and the script will continue on to the next row.
How you can adapt it
There are only a few areas of the script you will need to alter going forwards depending on what you want to achieve:
  1. Lines 22 to 33 get the actual column data from the spreadsheet, so if you add more columns then just copy these lines and update the column number.
  2. Lines 48 to 57 are used for composing the email - you may wish to change the subject, reply email address or add more content to the email, so expand as required.
As usual there is downloadable version at the bottom of this post.

Email from spreadsheet data.xlsx

No comments:

Post a Comment