Merge Images

How do I dynamically mail merge images, QR codes and barcodes?

This article describes how to merge images that have a public URL. Such images can come from Google Search, Google Drive or online services that generate QR codes and barcodes from a URL.

Merge Images from a Public URL

This section describes how to merge a generic image with a public URL, irrespective of the origin of the image.

NOTE: If you wish to merge images from Google Slides to Google Slides Presentation files, please refer to this article which is specific to that topic.

Step 1

In Google Sheets, create a new column and name it whatever you want, but include the tag <img>, e.g. Profile Photo <img>

This column forms the basis for being able to add images to your mail merge.

Step 2

Paste your image URL in the applicable cells of your new column (with the <img> tag).

Your image URL can come from a variety of sources, such as Google Search, Google Drive or online services that generate QR codes and barcodes from a URL. Please refer to the section below to find out how to obtain your image URL.

Repeat the steps above for each image that you want to merge.

This enables a mail merge image to be specified for each row to be merged.

NOTE: The image URL cannot be more than 235 characters in length.

Step 3

In your merge template, insert the image *|merge field|* as you would for any other merge field, e.g. *|Profile Photo <img>|*

Your mail merge picture will be displayed in the location where you insert your *|merge field|*.

Merge Template

Merged Content

Obtain Your Image URL

This section describes how to obtain your image URL from Google Search, Google Drive or online services that generate QR codes and barcodes from a URL.

Google Search

Search for your image using Google Search, as shown in the example below.

Right-click on the public image and click Copy image address.

This will copy the image URL from Google Search, ready to be pasted into your Google Sheet.

Google Search can be used to find photos to mail merge, as well as many other image types.

Google Drive

Step 1

If your image is already hosted on Google Drive, proceed to Step 2.

If not, upload your image to Google Drive by clicking New > File Upload and selecting your image file.

Google Drive will host your image to mail merge online.

Step 2

Once your image file has uploaded, right-click on the image file in Google Drive and click Get Link.

Step 3

Click on the access settings drop-down and select Anyone with the Link.

This will ensure that your mail merge picture can be accessed and merged by the Mail Merge add-on.

Step 4

Click Copy Link.

This will copy the image URL from Google Drive.

Your image URL is now ready to be pasted into your Google Sheet to add the image to your mail merge.

QR Code

Create your QR code using an online service, such as Google Charts QR Codes or Image Charts.

Copy the image URL for your QR code.

An example mail merge QR code created using Google Charts QR Codes can be found below, along with its parameters and URL.

Root URL: https://chart.googleapis.com/chart?

QR code: cht=qr

Image size: chs=128x128

Data to encode: chl=samuel%20reeves

Complete QR code URL: https://chart.googleapis.com/chart?cht=qr&chs=128x128&chl=samuel%20reeves

You can quickly create a unique mail merge QR code for each data row by using a formula in your Google Sheet (see the screenshot below).

Barcode

Create your barcode using an online service, such as Online Barcode Generator.

Copy the image URL for your barcode.

An example mail merge barcode created using Online Barcode Generator can be found below, along with its URL.

You can quickly create a unique mail merge barcode for each data row by using a formula in your Google Sheet (see the screenshot below).

Advanced Feature: Resize the Original Image

You can specify the width and height of the image (in pixels) within the <img> tag.

In the example below, the column header Profile Photo <img|200x100> would resize the image width to 200 pixels and height to 100 pixels for all mail merge photos within that column.

NOTE: Any change of image size within your column header needs to be replicated in the corresponding *|merge field|* of your merge template (and vice-versa).

Advanced Feature: Combine Strings of Text for the Image URL

You can combine multiple strings of text by using the & character in the Google Sheets formula bar (see screenshot below). This is especially useful to mail merge QR code and barcode URLs.