How do I dynamically mail merge images, QR codes and barcodes?
If your image is already publicly available through a URL, proceed to Step 4. Otherwise, follow these steps to make your image publicly available on Google Drive.
If your image is not already hosted on Google Drive, upload it by clicking New > File Upload.
Right click the image file in Google Drive and click Get Link.
Click on the access settings drop-down and select Anyone with the Link, and then click Copy Link to copy the link in the dialog box.
In Google Sheets, create a new column and name it whatever you want, but include the tag <img>, e.g. Photo <img>
Paste the copied image file link in the desired cells of the column with the <img> tag.
Repeat the steps above for each image that you want to merge.
In your merge template, insert the image *|merge field|* as you would for any other merge field, e.g. *|Photo <img>|*
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: 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 want to easily create unique URLs based on data you already have in your sheet. This is especially useful for QR code and barcode image URLs.
You can combine multiple strings of text by using the & character in the formula bar within Google Sheets (see screenshot below).
The following sample can be produced, as shown in the screenshots below.
NOTE: The URL cannot be more than 235 characters in length.