MailMerge

Using Gmail for a Mail Merge

This Mail Merge Script is from the official Google Solutions website, and was reviewed and tested by ITS in June 2021. The first time you use the script you will be asked to give it permission to access your email. The script only uses this permission to send the emails you are asking to send.

As with any Mail Merge, please send a test email to a colleague before sending the email out to the full mail merge contact list.


  1. Make sure you are logged into your NEC Google account.

  2. Click on this link to make a copy of the NEC Mail Merge Template in Google Sheets. You can add new columns to this sheet for the elements you want to include in the mail merge, but you should not remove the Recipients or Email Sent columns. These are required for the mail merge to run.

  3. Update the Recipients column with email addresses you would like to use in the mail merge/

  4. Leave the Email Sent column empty. This column will auto-fill to confirm the email has been successfully sent to the address in the Recipient column.

  5. Create a draft message in your Gmail account using markers such as {{First}}, which correspond to column names in the Google Sheet, to indicate text you’d like to be replaced with data from the copied spreadsheet.

  6. Leave the Recipients empty.

  7. Copy the subject line text of the email, so you can paste it into the script later in the process.

  8. In the NEC Mail Merge Template, click on the Mail Merge menu and choose Send Emails.

  9. The first time you do this, you will be asked to authorize the script for your account. Read the authorization notice, allow it to access your Gmail, and continue.

    • You will only be asked for this permission the first time you use this script on your account.

    • If you do not immediately see a dialog box asking for your email subject line, choose Mail Merge > Send Emails again.

  10. ​When prompted, paste the subject line used in your draft email message and click OK. The script uses the subject line text to find the message you want to merge with in your Drafts.

  11. The mail merge will begin immediately. The Email Sent column will update for each message when that recipients message is successfully sent.


Sending another email to the same list

If you want to reuse the same Google Sheet to send another mail merge, you will need to clear the Send Emails cells.The mail merge script will skip any rows that have the timestamp field filled in. Select only the cells with timestamps in them and delete. Remember to leave the Send Emails column header alone.


Images and Attachments

Your email message can contain images and/or attachments, but they will be the same for all of the recipients. If you need to send a mail merge with recipient specific attachments, please contact the Help Desk for information on how to use Outlook mail merges with your gmail account.