A client recently asked me for help with creating what they called an Employee Directory. It was basically a Word document that included, for each employee, their name, their email address, in a clickable format and and their photo.

If they only had a few employees they could probably have created this manually but they had a couple of hundred. So my idea to get this job done quickly was to use the Mail Merge feature of Word.

If you’re not familiar with Mail Merge, it automates the generation of personalized documents – letters, labels, catalogues, to name but a few, by merging a Word document with a data source.

The data source is often an Excel file that contains the individual pieces of information to be pulled through to the document.

In this video, which is based on my client’s request… the names and email addresses are in a CSV file which has been generated from a data export from the company’s HR system and the photos are individual JPG files which I’ve placed in a folder on my desktop.

If you’re wondering where Excel comes into the demo, I used Power Query to create a single Excel file that contained the data in the CSV file and the names of the JPG files. This Excel file was used as the source for the Mail Merge.

Use Power Query to Import the Employee Data

Use Power Query to Import the Image Filenames

Set up the Merge Document (Including Loading the Images)

The formula used to insert the images into Word:

{INCLUDEPICTURE {IF TRUE {MERGEFIELD “Photo”}} \d}

You can download a copy of the file I used in the video by clicking through to YouTube. The link for the file is in the YouTube description.