Skip to content
Branch: master
Find file History
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Create a mail merge using Gmail and Google Sheets (#65) Sep 17, 2019 FIx image link, metadata tags (#68) Sep 19, 2019
mailmerge.gif Create a mail merge using Gmail and Google Sheets (#65) Sep 17, 2019

title description labels material_icon create_time update_time
Create a mail merge using Gmail and Google Sheets
Create and distribute visually rich mail merges with Gmail and Google Sheets.
Sheets, Gmail

Contributed by Martin Hawksey, follow me on Twitter @mhawksey or read my Google Apps Script related blog posts.

Simplify the process of producing visually rich mail merges using Gmail and combining it with data from Google Sheets. With this solution you can automatically populate an email template created as a Gmail draft with data from Google Sheets. Merged emails are sent from your Gmail account allowing you to respond to recipient replies.

Mail merge with Gmail and Google Sheets

Technology highlights

Try it

  1. Create a copy of the sample Gmail/Sheets Mail Merge spreadsheet.

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

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

  4. Click on custom menu item Mail Merge > Send Emails.

  5. A dialog box will appear and tell you that the script requires authorization. Read the authorization notice and continue.

  6. When prompted enter or copy/paste the subject line used in your draft Gmail message and click OK

  7. The Email Sent column will update with the message status.

Next steps

Additional columns can be added to the spreadsheet with other data you would like to use. Using the {{}} annotation and including your column name as part of your Gmail draft will allow you to include other data from your spreadsheet. If you change the name of the Recipient or Email Sent columns this will need to be updated by opening Tools > Script Editor.

For more information on the number of email recipients that can be contacted per day you can read the Current Quotas documentation. If you would like to find out more about the coding pattern used to conditionally read and write Google Sheets data here is a related blog post.

To learn more about Google Apps Script, try out the codelab which guides you through the creation of your first script.

You can also view the full source code of this solution on GitHub to learn more about how it was built.

You can’t perform that action at this time.