

SpreadsheetDB is a small library (a collection of useful functions) that allows us to quickly process rows in a spreadsheet, referencing columns by their header names. It will use the built in SpreadsheetApp library to access the spreadsheet, the SpreadsheetDB library to perform basic data lookup operations on the spreadsheet, and the built in GmailApp library to look up drafts and send emails. We’ll call it performMailMerge and it won’t have any parameters, e.g.: function performMailMerge() We’re going to write a function to perform the mail merge. This creates a new Apps Script associated with your spreadsheet. Inside your spreadsheet, choose Tools > Script Editor. (To add yourself to my spreadsheet and actually receive a happy birthday email on your alleged birthday, just ) with three columns like this: Name Email Age You may be getting older, but you're still the coolest person I know. Happy birthday! I think you,, personally are awesome. We’ll use angle brackets for the parts of the message we want to replace with data from our spreadsheet. With practice, you can perform tasks like this in well under an hour.įirst, we draft the email in Gmail. This will involve writing a template email, creating a spreadsheet, and writing a small amount of JavaScript code. In this section we use Google Apps Script to create a mail merge that sends personalized “Happy Birthday” messages to a group of our friends.

Each recipient receives a personalized copy of the email. Part 1: Writing a Mail MergeĪ mail merge is a program that sends an email to many recipients, automatically filling in the contents of the email according to a template.
Mail merge google how to#
In the second part of this post, you will learn how to schedule these emails to send in the future. It’s less than 30 lines of code! You can use this technique to send personalized emails individually to many recipients.

Google Apps Script is endlessly useful in this post you will learn how to write a mail merge with Google Apps Script.
