Images

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

Step 1

In Google Drive, add your image (if not already there) by clicking New and then File Upload.

Alternatively, you can use an image from a public URL. In this case, copy the image link from the public URL and jump to Step 4.

NOTE: The steps below describe the process for merging images, but the same process applies to QR codes and barcodes. You can use an online service to generate a QR code or barcode URL, such as Google Charts QR Codes or Barcodes Inc.

Step 2

Right click the image file in Google Drive and click Get Link.

Step 3

Click Copy Link to copy the link in the dialog box.

Step 4

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

Step 5

Paste the copied image file link in the desired rows in the column with the <img> tag.

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

Step 6

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

Merge Template

Merged Content

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 Photo <img|200x100> would resize the image width to 200 pixels and height to 100 pixels for all images within that column.

NOTE: If you change the image size in your column header in Google Sheets, you also need to change the size entered in your *|merge field|* in your merge template (and vice-versa).

Advanced Feature: Formula to Combine Two Strings of Text

Method 1

A formula can be used in Google Sheets to combine two separate strings of text. When used with QR codes or barcodes, the formula can be used to combine a common QR code or barcode URL component with a variable merge field. This enables unique QR codes or barcodes to be generated rapidly for numerous rows of data.

NOTE: The example below focuses on QR codes, but the same formula can be used for barcodes.

The first method combines two strings of text using the 'concat' formula.

Method 2

The second method combines two strings of text simply using the '&' character.

Methods 1 & 2 produce the same result following mail merge with the example QR code, as shown in the screenshot below.

Merge Template

Merged Content

NOTE: Method 2 can also be used where the variable merge field is in the middle of the common URL component, rather than at the end, as demonstrated in the screenshot below.