Skip to content

How to Use Embed Markers in Mail Merge

A merge field like {{First Name}} puts the text of a cell in your email. An Embed marker puts something else there: a QR code, a barcode, a picture, a link, a table or chart from Google Sheets, or a file attachment.

You type the marker in the message of your email. You don’t need a formula or an extra column in your sheet.

Maya runs Brand Basics, a workshop at Willow Lane Studio. Her guest list is in a Google Sheet:

First Name Email Address Session Seat Calendar Link
Daniel daniel.okafor@example.net Saturday, January 10 at 10 AM B4 https://example.com/cal/jan10
Hannah hannah.weber@example.org Saturday, January 17 at 2 PM A1 https://example.com/cal/jan17

She writes one email with three Embed markers:

Hi {{First Name}},
You're booked for Brand Basics on {{Session}}. Your seat is {{Seat}}.
Show this code at the door:
{{Embed QR Code, "Brand Basics - {{First Name}} - Seat {{Seat}}", width=200}}
{{Embed Link, Add the session to your calendar, {{Calendar Link}}}}
{{Embed File, Directions to the studio.pdf}}
See you there,
Maya

Daniel gets his own QR code and his own calendar link. Mail Merge also attaches the directions PDF to his email.

Marker What it adds to the email Example
Embed QR Code A QR code that a phone camera can scan {{Embed QR Code, {{Seat}}, width=200}}
Embed Barcode A barcode for a store or warehouse scanner {{Embed Barcode, {{Gift Card}}, format=Code 128}}
Embed Image A picture from the web or from Google Drive {{Embed Image, {{Home Photo}}, width=500}}
Embed Link A link with the text you choose {{Embed Link, View your order, {{Order Link}}}}
Embed File A file attachment from Google Drive {{Embed File, Price List 2027.pdf}}
Embed Range A table copied from a Google Sheet, with its formatting {{Embed Range, 1AbC…789, address=Prices!A1:C10}}
Embed Chart A chart from a Google Sheet, as a picture {{Embed Chart, 1AbC…789, sheet=Dashboard}}

Every Embed marker has the same three parts, with a comma between them:

{{Embed QR Code, {{Seat}}, width=200}}
  1. The name, like Embed QR Code. The name says what to add.
  2. What it holds, like the Seat column. For a link it is the link text, for a file it is the file, and for a table or chart it is the spreadsheet.
  3. Options, like width=200. Each marker has its own options, and you can leave them out.
  1. Go to Extensions > Mail Merge with Attachments > Open Mail Merge, open your campaign and move to the Template step.

  2. In the Message box, click where the code, picture, link or table should go. Type the marker on a line of its own.

  3. Click Send Test Email and send the email to yourself. The test uses row 2 of your sheet.

Embed markers work in the visual editor, a Gmail draft, HTML, Markdown and a Google Doc.

You can write the value after the first comma in four ways. The rule is the same for every Embed marker.

You write The marker holds If the column is missing
{{Embed QR Code, {{Seat}}}} The Seat cell of that row Nothing is added
{{Embed QR Code, Seat}} The Seat cell of that row The word Seat
{{Embed QR Code, "Seat B4, Studio 2"}} The text in quotes, exactly as typed
{{Embed QR Code, "Brand Basics - {{First Name}} - Seat {{Seat}}"}} The text, with First Name and Seat filled in for that row

Which one should you use?

  • Use {{Seat}}, with its own braces, for a value from your sheet. If you misspell the column title, the email gets no code, which is easy to spot in a test.
  • Use quotes for text you type. Quotes keep commas in the text, and they stop Mail Merge from reading the text as a column title.
  • Put merge fields inside the text to join columns. "{{First Name}} {{Last Name}}, seat {{Seat}}" gives Daniel Okafor, seat B4.
  • The form without braces or quotes also works. But if you misspell the column title, Mail Merge makes a code of the misspelled title.

Column titles match the same way as in a merge field: {{seat}}, {{SEAT}} and {{Seat}} are the same column.

When the cell is empty, Mail Merge adds nothing. There is no broken picture, no empty link and no attachment.

Put options after the value, with a comma before each one.

{{Embed QR Code, {{Seat}}, width=200, textcolor=#1A3C6E, backgroundcolor=#FFF8E1}}
{{Embed Barcode, {{Gift Card}}, format=Code 128, height=10, includetext=false}}
{{Embed Image, {{Home Photo}}, width=500, align=center}}
  • Write an option as name=value. Capital letters in the name don’t matter, and spaces around = are fine.
  • An option can take its value from your sheet, like format={{Barcode Type}}.
  • A single word, like includetext, means includetext=true.
  • If you write an option twice, Mail Merge uses the last one.

Commas separate the parts of a marker, so text with a comma needs quotes.

You write What happens
{{Embed QR Code, Hello, World}} The code holds Hello only. Put the text in quotes.
{{Embed QR Code, "Hello, World"}} The code holds Hello, World
{{Embed QR Code, “Hello, World”}} The same. Curly quotes from Google Docs or Word work too.
{{Embed QR Code, 'Hello, World'}} The code holds 'Hello only. Single quotes aren’t read as quotes.
{{Embed QR Code, {{Last, First}}}} The Last, First column. A comma inside the inner braces is fine.
{{Embed QR Code, {Seat}}} The marker stays in the email as typed. A single { or } isn’t allowed inside a marker.
{{Embed QR Code; Seat}} Nothing. The comma after the name is needed.
{{Embed a QR Code, Seat}} Nothing. The name must be exact.

Text in quotes can’t contain a double quote of its own.

Embed markers work in the message of an email. Mail Merge removes the markers and adds nothing in these places:

  • The Subject and the sender’s name
  • A plain text email, which can’t show pictures or tables. Embed File still attaches its files there, and Embed Link writes its text followed by the address in parentheses.

Type each marker as normal text. Bold, a color or a line break inside the marker does no harm.

What happened Result
The cell is empty Mail Merge adds nothing and sends the email
A file in Embed File, or a Drive picture in Embed Image, can’t be found Mail Merge doesn’t send that row’s email. The Mail Merge Status cell says Invalid attachment - …
The spreadsheet or range in Embed Range or Embed Chart is wrong The campaign stops and the log shows the reason, because every email would have the same problem

See how to fix attachment errors for each status.

Copy a marker and change the column titles to match your sheet.

Goal Marker
Event ticket with a code to scan {{Embed QR Code, {{Ticket ID}}, width=220}}
A code that opens each person’s page {{Embed QR Code, https://example.com/t/{{Ticket ID}}}}
Wi-Fi card for guests {{Embed QR Code, "WIFI:T:WPA;S:Willow Lane Guest;P:brandbasics;;"}}
Gift card for a store scanner {{Embed Barcode, {{Gift Card}}, format=Code 128}}
Your logo, the same in every email {{Embed Image, https://example.com/logo.png, width=160}}
Staff photo from Google Drive {{Embed Image, {{Photo}}, width=120, align=center}}
A link to each person’s order {{Embed Link, View your order, https://example.com/orders/{{Order Number}}}}
A link that starts an email to you {{Embed Link, Email us, mailto:hello@example.com}}
Each client’s own invoice PDF {{Embed File, Invoices/{{Invoice Number}}.pdf}}
The same brochure for everyone {{Embed File, Brochure.pdf}}
This week’s price list as a table {{Embed Range, 1AbC…789, address=Prices!A1:C12}}
The monthly sales chart {{Embed Chart, 1AbC…789, sheet=Dashboard, position=1, width=560}}
  • The marker names can be written with or without spaces and in any case: {{Embed QR Code, …}}, {{Embed QRCode, …}} and {{embed qr code, …}} are the same. Embed Picture is the same as Embed Image, and Embed URL is the same as Embed Link.
  • {{Embed Link}}, with no comma, is an ordinary merge field for a column titled Embed Link.
  • You can’t put one Embed marker inside another.
  • Mail Merge never processes what a marker adds. If a cell in an embedded table holds the text {{First Name}}, the email shows that text.
  • QR codes, barcodes and web pictures load when the reader opens the email. Some email apps, like Outlook, hide pictures until the reader clicks Download pictures. Mail Merge attaches pictures from Google Drive and charts inside the email, so they always show.

Check these in order:

  1. Is the template plain text, or is the marker in the subject? Embed markers work in the message only, and only Embed File and Embed Link work in plain text.
  2. Is the name exact? Embed QR, Embed a QR Code and Embed Maps aren’t Embed markers.
  3. Is there a comma after the name?
  4. Is the cell empty for that row, or is the column title in the inner braces misspelled?

The QR code or barcode holds a column title

Section titled “The QR code or barcode holds a column title”

The marker has no braces around the column title, like {{Embed QR Code, Seat}}, and no column has that title. Write {{Embed QR Code, {{Seat}}}} and check the spelling.

The text has a comma, so Mail Merge read the rest as options. Put the text in quotes, like {{Embed QR Code, "Seat B4, Studio 2"}}.

A brace is missing, or the marker has a single { or } inside it. Type the marker again with two braces at each end.