In this installment of Learning Adobe InDesign, we take a look at data merge (also known as a mail merge) and how to set up your InDesign document.
What Does Data Merge Do?
Data merge allows you to take an Excel Spreadsheet, with rows and columns of data, and merge those fields into their assigned places in InDesign. Data merge is commonly used for form letters, addresses on envelopes, mailing labels and can even be used for numbering. For this example, we will look at an Excel spreadsheet that contains information that needs to be used to create a form letter and envelopes. Using the same data source file, we can create both the letter and envelope easily.
Step 1: Check the Data Source File
The data source file is most commonly an Excel spreadsheet set up with columns that have the designated labels for name, salutation, address, etc. and rows that have the information for each recipient of the form letter and envelope. Row one of your spreadsheet should have the labels for each column; be sure that each column has a unique label to keep them separate when merging into InDesign.
When checking your Excel spreadsheet and making sure that all labels and rows are correct, how the data is input into each row is how it will show when you merge the document into InDesign. If each row is typed in all caps, then the merged document will be in all caps. You will most likely want your envelope to have the mailing name and address in all caps, but on the form letter you will want the salutation to be in upper and lower case.
Step 2: Export the Data Source File
Once you have all the rows and columns adjusted, you need to save the Excel spreadsheet as a comma-delimited file (.csv) or a tab-delimited (.txt) file. This will generate a document that has each piece of data separated by a comma or tab depending on the format you save it as.
Step 3: Set Up Your InDesign File
Create your form letter as an 8.5x11 page. If your letter is two sided, create a two page 8.5x11 document. Design your letter appropriately marking the areas that will include data from the merge with designations like < < name > > and < < address > > so you can replace them with the merged data. If the body of your letter has areas in it that will be merged with the data, like a donation amount for donor letters, be aware that the length of the information you are merging can fluctuate and cause your text to reflow. This can be a problem if you want to place a signature at the end of the letter. If all of the text is in one text box the the space for the signature could possibly move up or down depending on the length of the merged text. To accommodate for this, make the signature line at the end its own text box and place it far enough away that the body text will not touch it.
Step 4: Import the Data Source File
To import your data source file, choose Window > Utilities > Data Merge to bring up the Data Merge panel. Click the three lines in the upper right hand corner and choose Select Data Source. This brings in the CSV or TXT file and place the column names into the Data Merge list allowing you to select the label name of the data for your letter.
Step 5: Insert Merged Data
Highlight the areas from step three that the data will replace in your letter. With the text selected, click the data field you want to replace the highlighted text. You should see it replaced with < < label_name > >. Continue replacing the text in the letter with the data labels until you have all the necessary fields replaced.
Empty Fields
On a document like business cards, you may come across some fields that will not have data to merge in the source data file. If a business card has a space for Office, Fax and Cell but some rows only have Office and Cell, you will want the space for the Fax number to be removed. Once you have entered all of the label fields into your text document, highlight the text of your data labels and choose Content Placement Options from the Data Merge panel menu. Click the Remove Blank Lines for Empty Fields. Now, wherever there is an empty field in your data source file (for the labels you have inserted), the empty space will be eliminated.
Add Images
The Data Merge function will also allow you to place a different image on each merged record. In order to add the photos, you need to have a column in the Data Source File where you can enter the exact pathway of the images. To designate the column as an image column, type a @ before the name of the column in the first row. For example I would name the column for images @images. In this example, I have a folder on my desktop that holds all of the images for the Data Merge named “data_images”. To find the direct path to the folder of images, select the folder and choose File > Get Info from the menu bar. The path is located in the Where section. Select and copy the path, then paste it into the row for your first image in the Data Source File. It will look like this: /Users/name/Desktop/data_images/. Enter your hard drive name before the first / of the path: hard disk/Users/name/Desktop/data_images/. Next, change the /'s to : then select the full path and copy. Enter the name of the image for the row you are on: hard disk:Users:name:Desktop:data_images:image1.jpg. Proceed to paste the full path into the next row and add the image name at the end until all the images have been entered and save your file.
If you have saved the image paths to your current CSV or TXT file, you only need to choose Update Data Source in the Data Merge panel menu and photo should show up in your list. Draw your picture box where it is needed and with the box selected, click the photo label. Now you can preview each merged record to make sure the image is showing. If everything looks good, proceed to export your file (step 7).
Step 6: Preview Your Document
Once all of the fields have been replaced you can preview your file to make sure there are no errors and no text has dropped off because of text reflow. In the Data Merge panel, click the three lines in the upper right hand corner and choose preview, or click the preview box at the bottom left hand corner. Your document should reflect the merged data in the fields you designated. To see other pages, you can click the right and left arrows, or to go to the end or beginning by clicking the arrows with lines to the side of them. If your document has two pages, you will need to scroll between the two to check for errors. If you see the red plus arrow at the end of your text box during the preview, you will need to make the text box larger.
Step 7: Export Your File
When exporting, you can export the file as a PDF, or choose to Create a Merged Document. To export a high resolution PDF file, choose Export To PDF. Select all records, or only choose certain pages to export. Be sure to have the Generate Overset Text Report with Document Creation check box selected to show if any text reflow occurs when exporting; and the Alert When Images Are Missing checkbox selected if your merged data has any images placed. Click OK and choose the correct Adobe PDF Preset for a high resolution print PDF or a lower resolution PDF setting for email.
Choosing the Create a Merged Document allows you to create an InDesign file with a page for each row of data within your source file. To export a Merged Document, choose Create a Merged Document from the panel menu. Select all records, or only choose certain pages for the merged document. Be sure to have the Generate Overset Text Report with Document Creation check box selected to show if any text reflow occurs when exporting; and the Alert When Images Are Missing checkbox selected if your merged data has any images placed. Click OK. A new document will be created with all of the pages from the data source. Depending on the number of records in the data source, this could take a while to generate.
This feature works best if you have a document like business cards, that will require corrections. Without creating a merged document, any changes will have to be made to the Excel spreadsheet and then choosing Update Data Source from the Data Source panel menu. If you create a merged document, then you can make changes to it without having to edit the data source file.
If you have any questions about using Data Merge in InDesign, contact us and we will be glad to help.
Would you like more helpful print related articles sent to your inbox? Subscribe to our mailing list and receive our bi-weekly article posts every Tuesday and Thursday.