How to Use Mail Merge in Google Sheets?

By Rohit Mehta - Founder & Editor 20 Views
6 Min Read

In today’s article, we will tell you how you can use Mail Merge in Google Sheets. Apart from this, we will also tell you how Mail Merge works in Google Sheets. So let’s start today’s article without delay.

How Mail Merge Works?

Mail Merge can send emails or documents using any spreadsheet or database data. To create a mail merge, you need a template that contains placeholders or a spreadsheet that contains values ​​to insert the placeholders. The values ​​in the Spreadsheet are merged through an email template to create a personalized email.

To use Mail Merge in Spreadsheet, you should know about Google Sheets. Apart from this, you should have a little knowledge about Apps Script and Basic Coding Concepts. Let us now understand how we can send Personalized Emails using Mail Merge in Spreadsheet.

First Step:- First of all, make a sheet where the data to be emailed is present.

  • In Spreadsheet, first, you have to create a sheet that will contain your data, and it will contain all the necessary information needed to send an email template to different placeholders.
  • You have to keep in mind here to use different headers for each column, as you will be using these values ​​in the email template.
  • Important data present in this sheet-like First Name, Last Name, Email ID, Name of the letter Topic of the email, etc., of the person to whom you have to send the Mail.

Second Step:- Now, make a sheet that contains the email message and its subject.

  • Please create a new sheet and name it Templates.
  • Now, write the email subject in the sheet and the matter of the email in the sheet. For example, in cell A2 of the sheet, you write the subject of the email, and in cell A5, write the matter of the email.
  • By using placeholders, you can specify which sheet to use the data from. The format of any placeholder is ${<HEADER NAME>}} in which <HEADER NAME> is the header of the column from which we have to insert the value in the email.
  • If you want, you can also use placeholders between the subject and body of the email.

Step 3: Prepare an Apps Script in which Mail Merge can work after the data is read from your sheet and sent to Mail.

  • To use mail merge in Spreadsheet, we need code. If we talk about its full code, it is very long and is not easily understood by everyone. There are mainly four main functions in any app script.
  • getData()- By this, you can divide the contents of a sheet into a two-dimensional array.
  • Render template() – Takes a template and an object as input and replaces the value in the placeholders with the object in the template.
  • Rows to objects()- This converts an Array of Rows to an Object. Apart from this, every row becomes an object in which column header properties become.
  • Send emails()- This is the main function, and all other functions create and send personalized emails.
How does any code work?

To understand any code, the first one must understand sending emails() because that is where all the work starts. Send emails() comes first because it takes templates from sheets. It then converts all the datasheet rows into an array of objects. Here, every row becomes an object.

The column names in the header row are used as property names while creating the object. After this, the First Step is to delete the Header Row. After this, each row is converted into an object, and the objects are added to an array called data. These values ​​are known as the property name. The shift() array function removes the first item from the array and returns the item.

Step 4- Run the Script to Send Email

  • Now, from the mail merge menu, you have to click on the Play icon, for which you have to run the script, and through this, you can send the email. For this, you will be asked to authorize the script. When you authorize the script, your script starts running, and your email starts going.
  • Mail Merge is a very important and profitable concept. By the way, there are many ways for you to merge data in the template of a sheet by which you can personalize your content.
  • With the help of templates in Google Docs and data in Google Sheets, create Invoices.
  • If you want, you can make Printable Address Labels to send holiday cards to your friends and relatives.
  • You can create a template in Google Docs and a Question Library in Google Sheets to send personalized quizzes to your students.

Conclusion

You learned today how you could send Personalized Emails using Mail Merge and Google Sheets through today’s article.

  • Personalized emails and documents are created with the help of Spreadsheet data or database in any Mail Merge.
  • To use Mail Merge in Google Sheets, you will need a spreadsheet containing data and templates that you will send via email.
Share This Article
Exit mobile version
x