New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
Sending and campaignsUpdated 17 Oct 2026

What Is Mail Merge? How It Works in Word, Excel and Gmail, and How to Do It in Code

Mail merge combines one template with one list of data to produce many personalised messages. This guide explains the three parts of a merge, step-by-step instructions for Word with Excel, notes on Gmail and Google Sheets, a Python example that sends through SMTP, how it compares to email marketing software, best practices and common problems.

VR
Written by Valentina Reyes
E-commerce Email Specialist
Reviewed by Hannah Mitchell
  • Published2 Oct 2026
  • Read time7 min
  • Length1,376 words
Share this guide

Mail merge is a way to produce many personalised messages or documents from one template and one list of data. You write the message once, mark the places where details change, such as a name or an order number, and the software fills them in for each row of your list. The term started with printed letters and is now used for email as well. This guide explains what mail merge is, how it works in Word, Excel and Gmail, how to do the same thing in code, and how to send merged email without landing in spam.

Templatethe message with placeholders such as {{first_name}}
Dataa spreadsheet or database with one row per recipient
Mergethe software combines them into one personalised message per row

What is mail merge?

Imagine you need to invite 200 customers to an event. Writing 200 separate emails is slow, and sending one email with everyone in Bcc is impersonal and risky. Mail merge solves it: you keep a list with columns such as first name, company and date, write one message with placeholders, and let the software produce 200 individual messages, each with the right details. The idea works for letters, labels, certificates, invoices and emails.

The three parts of a mail merge

  1. The main document or template. The fixed text plus merge fields, for example "Hello {{first_name}}, your appointment is on {{date}}."
  2. The data source. A table in which each column is a field and each row is a recipient. It can be an Excel sheet, a CSV file, a contact list or a database.
  3. The merge. The tool reads each row, replaces the fields and produces one output per row, which it prints, saves or sends.

How to do a mail merge in Microsoft Word with Excel

The menu names can differ by version, but the flow is the same.

  1. Prepare the Excel list. Put a header in row one, with one column per field, and one recipient per row. Make sure there is an email column and that there are no blank rows.
  2. Start the merge in Word. On the Mailings tab choose Start Mail Merge and then Email Messages (or Letters).
  3. Select recipients. Choose Select Recipients, then Use an Existing List, and pick your Excel file.
  4. Write the message and insert fields. Place the cursor where a detail should appear and choose Insert Merge Field.
  5. Preview. Use Preview Results to flick through records and check each one.
  6. Finish and merge. Choose Finish and Merge. For email, Word uses a mail program such as Outlook to send each message individually.

This is workable for a few hundred messages. It sends from your own mailbox, which has daily sending limits and no unsubscribe handling, so it suits personal or low-volume use.

Mail merge in Gmail and Google Sheets

Gmail has some built-in merge-style features in certain Google Workspace plans, and many add-ons work with Google Sheets. Features, limits and plan availability change, so check Google's current documentation. Personal mailboxes have daily sending limits, so a merge to a large list can be cut off partway. If you send more than a small number of messages, consider a sending service instead.

Mail merge with code: a simple example

If you can write a little code, you can build a merge that sends through an SMTP service, with no limits from a personal mailbox. This Python example reads a CSV file, fills in a template and sends one message per row. The host and credentials are placeholders.

import csv, smtplib
from string import Template
from email.message import EmailMessage

template = Template("Hello $first_name,

Your appointment is on $date.
")

with smtplib.SMTP("smtp.example.com", 587) as s:
    s.starttls()
    s.login("SMTP_USER", "SMTP_PASSWORD")
    with open("recipients.csv", newline="", encoding="utf-8") as f:
        for row in csv.DictReader(f):
            msg = EmailMessage()
            msg["From"] = "[email protected]"
            msg["To"] = row["email"]
            msg["Subject"] = "Your appointment"
            msg.set_content(template.substitute(row))
            s.send_message(msg)

This sends one message per recipient, so nobody sees another person's address. For production use add error handling, rate limiting, logging and a way to skip addresses that bounced or unsubscribed. Our article on template personalisation, variables and fallbacks explains how to handle missing values, and email API integration patterns covers retries.

Mail merge vs email marketing software

Mail merge from a mailboxEmail marketing software or a sending service
Best forSmall, one-off, personal sendsRegular campaigns and larger lists
Sending limitsLow daily limitsHigher limits, paced sending
Unsubscribe handlingManualBuilt in
Bounce handlingManualAutomatic suppression
ReportingNone or basicDelivery, clicks, complaints
Authentication of your domainDepends on the mailbox providerYour own SPF, DKIM and DMARC

See what email marketing software is for how the tools compare.

Best practices for sending merged email

  • Send only to people who expect it. Merge does not create consent. See an overview of the main email laws.
  • Clean the data. A missing first name should not produce "Hello ,". Use fallbacks such as "Hello there".
  • Preview several records, especially rows with long names, accents or missing fields.
  • Authenticate your domain. Set up SPF, DKIM and DMARC.
  • Include an unsubscribe option for anything that is marketing.
  • Start small and increase gradually. Read email warm-up.
  • Do not use Bcc as a shortcut. See what BCC means.

Common mail merge problems and fixes

ProblemCauseFix
Fields appear as raw text such as {{name}}The placeholder name does not match a columnCheck header names and spelling
Dates or numbers look wrongThe spreadsheet format is applied differently in the mergeFormat the column as text, or format in the template
Some people receive nothingBlank or invalid email cellsValidate the list first
Messages go to spamMailbox limits, no authentication or a cold listUse an authenticated sending service and warm up
Sending stops partwayA daily limit was reachedSend in batches or use a sending service

Before you merge, run the list through a validator. Our free email validator checks the format and domain of up to 100 addresses, and the validation product handles larger lists.

Merge fields beyond the first name

A first name is the simplest merge field, and it is not always the most useful one. The details that make a message relevant are usually specific to the person: an order number, an appointment time, a renewal date, a balance, a course name or a location. Putting these in the message turns a generic notice into something the reader can act on. Keep personalisation honest and useful, and avoid details that feel intrusive. A message that mentions information the person did not expect you to have damages trust.

Formatting matters too. Dates and currencies appear differently in different countries, so decide how you will format them and test with real rows. If your list includes several languages, keep a language column and a separate template for each language, instead of hoping one template will serve everyone. Our guide to template personalisation and localisation goes through the options.

Conditional content and fallbacks

Real lists are untidy. Some people have no first name on file, some have no company, and some have a field that is blank. A good template has a fallback for each field: "Hello there" when the name is empty, or no company sentence at all. Many tools support conditional blocks, such as "show this paragraph only if the plan is premium". If your tool does not, do the filtering in your data before you merge: split the list into groups and send each group its own template.

When to move beyond a spreadsheet merge

A spreadsheet merge works until the list changes often or the volume grows. Signs that it is time to move on are: you repeat the same merge every week; people ask to unsubscribe and you cannot track it; messages are triggered by events such as a purchase; or you need to know which messages bounced. At that point, use stored templates with variables, sent through an API or SMTP relay by your application. Our email templates and email API do this, and the article on choosing between SMTP and an API helps you pick the connection method.

Sending personalised email in volume? Tell us what your merge looks like, and we will help you send it through an authenticated relay or API, with logs and bounce handling.

Talk to us

References and further reading

Frequently asked questions

What is mail merge?

Mail merge combines one template with a list of data to create many personalised messages or documents. Placeholders in the template are filled in from each row of the list.

How do I do a mail merge in Word with Excel?

Prepare an Excel list with a header row, start a mail merge from the Mailings tab, select the Excel file as recipients, insert merge fields into your message, preview the results and choose Finish and Merge to send or print.

Can I do a mail merge in Gmail?

Some Google Workspace plans include merge-style features and many add-ons work with Google Sheets, but features and limits change, so check Google's current documentation. Personal mailboxes have daily sending limits.

Is mail merge the same as email marketing?

No. Mail merge is a method of personalising messages from a list. Email marketing software adds consent tools, unsubscribe handling, bounce handling, segmentation and reporting, which matter for larger or regular sends.

How can I send a mail merge without going to spam?

Send only to people who expect it, clean the list, use fallbacks for missing data, authenticate your domain with SPF, DKIM and DMARC, include an unsubscribe option for marketing, start with small batches and use a proper sending service for larger lists.

Topics#mail merge#personalisation#word#excel#gmail#bulk email#templates#smtp
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales