To add a different image to each mail-merge result in Word, put each image’s full file path in a column in your data source, then use a nested INCLUDEPICTURE and MERGEFIELD field in the Word document. After merging, update the picture fields in the new document. This method works well for portraits, product photos, badges, or other images that vary by recipient.
Prepare the images and data first, and test a few records before producing the full merge. Word’s standard Insert Merge Field list does not include a dedicated image option, so the picture is added with a field code instead.
What You’ll Need
- A desktop copy of Microsoft Word for Microsoft 365. The steps below use Word for Windows.
- A mail-merge data source, such as an Excel workbook or CSV file, with one row per record.
- A column with a full path to the correct image for each record. Use a clear heading such as
PhotoPath. - Image files in a format Word can display, such as JPG or PNG, stored somewhere Word can access.
- A folder location that will remain available while you create and use the merged document. If sharing the result, consider whether recipients also need access to linked image files.
Step-by-Step
-
Organize the image files. Put the images in one folder and give them distinctive, consistent filenames, such as a customer ID or product code. Avoid renaming or moving the files after you add their paths to the data source. If a filename contains spaces, that is usually fine, but check that the complete path points to the intended file.
-
Add an image-path column to your data. In Excel, add a heading such as
PhotoPathin the first row of a new column. In each record row, enter the full path to that record’s image. For example, one row might containC:\MailMerge\Photos\A104.jpgand anotherC:\MailMerge\Photos\A105.jpg. Keep the values as plain text and make sure every path is complete, including the drive or network location and file extension. Save and close the workbook before connecting it to Word. -
Start the mail merge and connect the data. In Word, open or create the document that will serve as the merge template. Select Mailings > Start Mail Merge and choose the appropriate document type, such as Letters or Labels. Select Mailings > Select Recipients, then choose your Excel list or other data source. If Word asks which sheet or table to use, choose the one containing the records and the
PhotoPathheading. -
Insert the other merge fields and make room for the picture. Add fields such as name or address from Mailings > Insert Merge Field. Click where the image should appear and put the insertion point in its own paragraph or in the appropriate table cell. If you are laying out a card or label, set the column width or cell size before testing. The INCLUDEPICTURE field will insert the image at the insertion point; you do not need to insert a sample picture first.
-
Insert the outer field braces. Press Ctrl+F9 on Windows. Word inserts a pair of field braces. Do not type ordinary curly braces from the keyboard: they will look similar but will not function as field delimiters. Inside the new braces, type
INCLUDEPICTURE ", including the opening quotation mark. -
Insert a nested merge field for the path. With the cursor just after that opening quotation mark, press Ctrl+F9 again to create another pair of field braces inside the first pair. Between the inner braces, type
MERGEFIELD PhotoPath, using the exact heading from your data source. Move the cursor to just after the inner closing brace and type" \d. The full field should look like{ INCLUDEPICTURE "{ MERGEFIELD PhotoPath }" \d }. The braces shown here represent Word field braces; insert them with Ctrl+F9 rather than typing them. -
Check the field and preview records. Click in the field and press F9 to update it for the current record. If necessary, use Mailings > Preview Results, then use the previous and next record arrows to inspect different records. A missing image or an error usually means the path is wrong, the file is unavailable, or the field heading does not match. Do not judge the final output only by the template: the merged document is where you should check the complete set of pictures.
-
Merge to a new document. Select Mailings > Finish & Merge > Edit Individual Documents, choose all records or the range you want, and select OK. Word creates a separate document containing the merged records. This gives you a chance to inspect and correct the result without changing your original template.
-
Update the picture fields in the merged document. In the new document, press Ctrl+A to select its contents, then press F9 to update fields. If Word displays a prompt about updating fields, confirm the update. Check the beginning, middle, and end of the merged document, especially if the merge contains many records. If images do not refresh at first, select the affected picture field and press F9 again. Save the merged document when the images display correctly.
Mac note: Word for Mac has the same basic mail-merge and field-code approach, though ribbon labels can vary slightly by release. Use Mailings to connect recipients and finish the merge. To insert field braces, use Command+F9; on some Mac keyboards you may also need to hold Fn. To update fields, use F9, or Fn+F9 if the function keys control hardware features. Check the Word shortcut settings if the keys do not insert or update a field.
Common Mistakes
- Typing field braces instead of inserting them. Braces typed from the keyboard are plain text, not Word fields. Create each pair with Ctrl+F9 on Windows or Command+F9 on Mac.
- Using a filename instead of a full path. A value such as
A104.jpgmay not tell Word where the image is. Use the complete path to the file and keep the folder in place. - Using a mismatched column heading. If the source heading is
Photo Path, the nested field must refer to that exact field name, notPhotoPath. Avoid changing the heading after building the field. - Updating the template but not the merged document. The preview can show one record at a time. Finish the merge to a new document, then update the fields there so each merged record can display its own image.
- Assuming a linked image travels with the document. The
\dswitch helps keep picture data out of the document and can leave it dependent on the original file location. If you send the merged document to someone, verify that the pictures remain visible on their computer or use a delivery method that includes the image files. - Leaving blank or invalid paths in some rows. A missing path can result in an empty space or a field error for that record. Check every row, not just the first one.
Tips
- Use a short, stable folder path and predictable filenames. This makes it easier to spot a typo and reduces the chance that a long path is entered incorrectly.
- Test with a small set of records that includes different images and any edge cases, such as a long filename or a record with no photo. Confirm the layout before merging everyone.
- Place the field in a table cell or paragraph with the alignment and spacing you want. After the image appears, adjust the layout in the merged document if the photos have different proportions.
- Keep a clean copy of the template and data source. If you need to correct paths or change the layout, revise those originals and create a fresh merged document.
- For a shared workflow, use a stable network or shared folder and confirm that the people opening the document have permission to access it. A path that works only on your computer will not work for another user.
Troubleshooting
The picture field shows an error or a blank area: Check that the path in that record is correct, including the extension, and open the image directly from that location. Check that the heading in the nested MERGEFIELD matches the source column. Also confirm that Word is allowed to access the folder and that the image is a supported file type.
Every record displays the same image: First confirm that each data row actually contains a different, correct path. Then update the fields in the merged document, not just in the template preview. Select the affected field and press F9. If a record still shows the wrong picture, inspect its path in the data source and confirm that the field is nested inside INCLUDEPICTURE exactly as shown.
The code appears instead of a picture: The field may have been typed as ordinary text, or Word may be showing field codes. Rebuild the braces with Ctrl+F9 (or Command+F9 on Mac), check that the code is inside the field braces, and press F9. If you pasted the visible code from another source, recreate the field braces inside Word.
Pictures show on your computer but not on another: The other computer may not have the same folder or permission to access it. Put the images in a shared location and update the paths, or provide the image files alongside the document and use paths that are valid for the recipient. Reopen the document on a computer with access before distributing it.
Images are too large or disrupt the page: Standard picture-field output may not fit a carefully designed label automatically. Try a test merge, adjust the available space or source image dimensions, and check the merged document at print size. Do not assume that changing the template alone has corrected every merged record.
Frequently Asked Questions
Can I insert an image using Insert Merge Field?
No. That menu inserts ordinary data fields, such as names and addresses. To vary pictures by record, use an INCLUDEPICTURE field containing a MERGEFIELD that supplies the image path.
Can the image paths come from Excel?
Yes. Add a text column to the Excel source with one full image path per row, save the workbook, and connect it through Mailings > Select Recipients. The path needs to identify a file Word can access.
Can I use this method for a company logo that is the same for everyone?
You can insert a logo directly with Insert > Pictures if it is identical in every record. Use the picture-field method when the image needs to change from one recipient or product to another.
Will the images stay embedded when I save the merged document?
That depends on how the picture field is set up and updated. The \d switch is commonly used for mail-merge pictures, but it can leave the document relying on the source files. Test the saved document after closing and reopening it, and make sure image files remain available if the document links to them.
Can I use PNG files or a network folder?
PNG files are suitable for this workflow, as are common formats such as JPG. A network folder can work if its path remains stable and the computer opening the merge has permission to access it. Test the exact files and location before producing or sharing the final document.
Why do I have to update the fields after merging?
The merge creates records from the data source, but Word may not refresh every INCLUDEPICTURE field automatically. Updating fields in the completed merge prompts Word to load the image path associated with each record.
Related
- Excel Text Across Cells Without Merging
- Excel Time Shortcut: How to Insert the Current Time
- Excel Time Format Over 24 Hours: Display Elapsed Time Correctly
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Workbook vs Excel Binary Workbook: Key DifferencesAn Excel workbook is the general name for a spreadsheet file; an Excel Binary Workbook is one specific…
- Excel Time Zones: How Date and Time Conversion WorksExcel does not assign a time zone to a date or time value: a worksheet cell holds a…
- Archive All Emails in Outlook: Bulk Methods and LimitsTo archive a large number of Outlook emails, select messages in a folder or search results and choose…
- Microsoft Word: How to Add a Header and Page NumberIn Microsoft Word for Microsoft 365 on Windows, choose Insert > Header, select a layout, and type your…
- How to Set Up Auto Forwarding in OutlookTo automatically forward incoming Outlook email, open Settings, go to Mail > Forwarding, enable forwarding, enter the destination…
- Excel Sum by Cell Color: Methods That Actually WorkExcel does not have a built-in SUMIF function that adds cells based on fill color. To total one…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.