Join Claudia McCue for an in-depth discussion in this video Using InDesign Data Merge with images, part of Print Production Essentials: Digital and Variable Data Printing.
- [Instructor] InDesign's Data Merge feature also lets you incorporate images but there are couple of little tricks that you need to know. First, let's take a look at the source excel file that I'm going to use. You can see in the columns, firstname, lastname, year, brand, model and so forth, and then this last column, is how I have to represent directory path to the Data Merge feature so that it can find the images that I want to use. So, how do you find the directory path for an image? Well, let me show you. On the Mac, just select the file, right click, and then choose Get Info, and in the Get Info dialog, there it is.
There is the complete directory path. Now, notice that it just goes up so far as the containing folder, Links. It doesn't include the file name. So, that you'd have to type manually. But this, at least, gets you off to a good start so I can copy that and then I can use it back in Excel. On Windows, it's very similar, slight difference. Select the file name, hold down the Shift key while you right click for file and then a context menu appears and from that, you choose Copy as Path. On either platform, once you've copied the directory path, switch back to Excel, click in the appropriate cell and then paste that directory path.
Now, you can see that's a really long-winded path. This is what's called an absolute path, it starts at the very beginning of the hierarchy and shows you the complete path. This is doable, it's tedious, but for a small project, you could use this, but you can imagine what fun this would be if you had 200 graphics that were intended to be used as variable content. Well, that's Windows proprietary personalization solutions start to become much more appealing but here's a tip. If possible, setup your links as a relative directory path.
Let me show you what I mean. Here, my InDesign file is in the same folder as a Links folder that contains all of the images that I'm going to use in Data Merge. I do have to get each path separately but it's a much shorter path. Let me show you how it looks in Excel. Remember, here's my absolute path, here are my relative paths, and what this notation here really means is InDesign. You know what folder you're in. Look down one level and you'll find a links folder, inside that, you'll find this file, scooter_1.psd.
It's a lot shorter, it's easier to police, to edit, to make sure that there aren't any problems with it, there's still some work involved, of course, in selecting that file name but you can see that it's a little easier to deal within this absolute path so I'm going to delete that absolute path and get rid of that. Once you've harvested those directory paths to identify the graphics in the Excel file, you have to do something else, you have to specially identify that column in a way that has meaning for the Data Merge function. The title needs to be the at sign and word, image, just @image, no space in between, ah, but watch what happens when I try to make that entry.
Excel squawks at me and the reason is that the at sign serves a special function in Excel and this is what this just doesn't seem right to me but I need that at sign for my Data Merge function. So, what I can do is what's called escaping, in other words, it's a way to the say to Excel, "No, no, don't invoke that special function, "I just need a plain old at sign", and to do that, I just type an apostrophe in front of that at sign. Now, InDesign can't digest this Excel file directly in the Data Merge function, I have to save it as a CSV file. That stands for Comma Separated Values.
That's really easy, you just choose File, Save As, and then choose Comma Separated Values for your file format. Once I've saved the Excel file, the CSV, it's ready to use in InDesign. By the way, I made two versions for you, one for Windows and a Mac version. So, make sure you pick the right one if you're working along in the exercise. Let's take a look at the CSV files I've provided for you in a text editor so that you can see the difference in them. Now, here's the Mac file, let's take a look at the CSV files I've provided for you here in the text editor so you can see the difference between the Mac version and the Windows version.
Now here, you can see the columns are broken apart by commas, that's why it's called Comma Separated Values and here's how the links are represented, how the link directory path is represented. On a Mac, it's /Links which means, go down one level, look in the Links folder slash go inside the Links folder and there's your file. Windows uses back slashes and the Mac uses forward slashes. That really the only difference. So again, if you're working along, make sure that you've picked the right one. Now, notice something else about this, at the end of the text, there are these two lines of commas with nothing in between 'em and what that represents is a bunch of empty records and that means that I'm going to end with two blank pages in my exported file using Data Merge.
It isn't a show stopper but you know what, I'm in my text editor, I might as well clean things up here. So, I'll just select those two empty lines and one more backspace so that I'm back at the end of my good line and then just save that file. Now, this is ready to go. Now, back in InDesign, I'll open up the Data Merge panel by going to Window, Utilities, and Data Merge, and then I'll select my data source by going to panel menu and choosing Select Data Source. There is my corrected Mac.csv file, and notice how those placeholders are represented, firstname, lastname, so forth and there's my image placeholder.
See how it looks different from everything else. So, I'm going to go ahead and put in my text placeholders, so I need a space then <<firstname>> and then down here, there's already a space that kind of hard to see but it's there, the <<year>> space <<brand>> space <<model>> and period. Don't forget those little spaces and periods, they are really easy to forget. Now, how do I get this image placeholder into these empty image frame? Really easy, I just grab it and drag and drop on top of the frame and you can see the word <<Image>> in little double brackets that tells you that this is a placeholder frame and also this big bold dash border around the frame tells you what it is.
Now, what about fitting? By default, the Data Merge feature uses the Fit Content to Frame option and if that's what you want, great, you're good to go, but if you need another option, you'll find that trying to change the local setting here, trying to select the frame and change the fitting setting has no effect. In this sense, Data Merge overrides anything you do locally to the frame. So, if you want to control fitting, you're going to have to do that through the Data Merge panel menu by choosing Content Placement Options. So again, as I mentioned, the default is Fit Images Proportionally which in this case is actually what I want so I'm ready to go but if you want something else, you'll have to choose it here, not by clicking on the frame and then right clicking and choosing there, that won't count, this is what counts.
So, I'll click OK because I'm ready to go and let's check everything before we generate the merged document. I'll check Preview and then as I page through, you can see that everything seems to be looking the way I want, this is great. So, I want a single record on each page so I'm going to choose that option as I create my merged document. So, in the Data Merge panel, I'll just come to the panel menu, choose Create Merged Document and it's Single Record, you can see they're chosen that here and that's the default and it's usually what I want anyway, and I wanted to alert me if there's anything missing.
I want to tell if there are overset text instances, I don't think there will be but when I click OK, this little alert comes up and that can panic you but this is saying, "No, it's good news, "there wasn't any overset text", 'cause remember, I asked it to warn me and when click OK, you'll notice, this is my original file, and this is the file that was generated as part of that merged process. So, what this means is that using Excel, I now have this well, semi-automated process that generates all of these customized versions of my little post card and now I can send it out.
I think this was really fun and I hope that at some point, you find this technique useful for you, for creating projects such as mailers or invitations or holiday cards.
- What constitutes "digital printing"?
- Printing short runs
- Working with digital color and large-format output
- Using InDesign's Data Merge feature to format variable data
- Printing on ceramics, metal, and wood