- InDesign User Guide
- Get to know InDesign
- Introduction to InDesign
- Workspace
- Generative AI
- Introduction to InDesign
- Create and layout documents
- Documents and pages
- Create documents
- Work with parent pages
- Work with document pages
- Set page size, margins, and bleed
- Work with files and templates
- Convert PDFs to InDesign files in InDesign (Beta)
- Create book files
- Add basic page numbering
- Number pages, chapters, and sections
- Convert QuarkXPress and PageMaker documents
- Share content
- Understand a basic managed-file workflow
- Save documents
- Grids
- Layout aids
- Documents and pages
- Add content
- Text
- Add text to frames
- Threading text
- South-East Asian Scripts
- Arabic and Hebrew features in InDesign
- Create type on a path
- Bullets and numbering
- Glyphs and special characters
- Text composition
- Text variables
- Generate QR codes
- Edit text
- Align text
- Wrap text around objects
- Anchored objects
- Linked content
- Format paragraphs
- Format characters
- Typography
- Format text
- Review text
- Spell check and language dictionaries
- Add references
- Styles
- Tables
- Interactivity
- Graphics
- Color and transparency
- Text
- Find and replace
- Share
- Publish
- Place, export, and publish
- Printing
- Extend InDesign
- Automation
- Troubleshooting
Learn how to personalize documents with text and graphics using data merge in Adobe InDesign.
Using the Data Merge panel in InDesign, you can easily create multiple variations of your document by merging a data source file (CSV or TXT file) with an InDesign document. For example, use the data merge functionality to create hundreds of variations of letters, envelopes, or mailing labels quickly and accurately. Data merge is also referred to as mail merge.
Prerequisites
All you need for data merge is a data source file and a target document.
- The data source file contains the information that varies in each iteration of the target document, such as the names and addresses of the recipients of a form letter. A data source file is made up of fields and records. Fields are groups of specific information, such as company names or postal codes, whereas records are rows of complete sets of information, such as a company’s name, street address, city, state, and postal code. A data source file can be a comma-delimited file (.csv), a tab-delimited (.txt), or a semicolon-delimited file in which each piece of data is separated by a comma or a tab, respectively.
- The target document is an InDesign document that contains the data-field placeholders, plus all the boilerplate material, text, and other items that remain the same in each iteration of the merged document.
The merged document is the resulting InDesign document that contains the boilerplate information from the target document, repeated as many times as it takes to accommodate each record from the data source.
A. Data source file B. Target document C. Merged document
Data Merge panel
Data Merge panel is accessible from Window > Utilities. The name and type of each data field is displayed in the panel. If you have inserted the data fields in your document, the page numbers where the data field is placed is also displayed.
A. Data Merge menu B. Create Merged Document C. Page number where data field is placed D. Preview last record E. Preview next record F. Go to record G. Preview previous record H. Preview first record I. Preview records J. Data field type and name K. Data source
1. Make plans to determine which data fields you’ll be using in your source and target documents.
Determine how you want the final document to look, so that you know which fields are necessary to accomplish the merge. For example, if you are creating a postcard that is mailed to customers, you can use the following data fields:
<<Company Name>><<Address>><<City>>, <<State>><<Postal Code>>
Your spreadsheet or database could look like this:
2. Save the data source file—usually a spreadsheet or database file—as a comma-delimited (.csv), tab-delimited (.txt), or semicolon-delimited text file.
Make sure that your data source file is structured in such a way that you can include the appropriate fields in your target document. For example, the top row of a spreadsheet should contain the field names that you’ll use in the target document, such as “Company” and “Address.”
For more information, see About data source files.
3. Create a target document that includes text and other items that remain the same in each version of the target document.
For more information, see About target documents.
4. Select the data source using the Data Merge panel.
For more information, see Select a data source.
5. Insert fields from the Data Merge panel into the target document.
You can add data fields to either a document page or a parent page. If you add data fields to a parent page, you have additional options.
For more information, see Insert data fields and Adding data field placeholders to parent pages.
6. Preview the records to make sure that the target document will look the way you intend.
For more information, see Preview records in the target document.
7. Merge the target document with the data source file, or export to PDF.
For more information, see Merge records.
About data source files
The data source typically originates from a spreadsheet or database application, but you can create your own data source file using InDesign or any text editor. Data source files should be saved in a comma-delimited (.csv), tab-delimited (.txt), or semicolon-delimited text format. Check your source application’s user guide for more information on exporting to these formats.
In a comma- or tab- or semicolon-delimited text file, records are separated by paragraph breaks; fields are separated by commas or tabs. The data source file can also include text or paths that see images on disk.
Example of comma-delimited data source file
Name,Company Name,State Bill Tucker,CoreVent Labs,Nevada Dat Nguyen,"Brady, Hunt, and Baxter, Inc",Delaware Maria Ruiz,"Brinquist Enterprises, Inc.",California
If you want to include a comma or quotation mark in a comma-delimited file, enclose the text within quotation marks, such as “Brady, Hunt, and Baxter, Inc.”. If you do not include the quotation marks, each name is treated as a separate field.
You cannot insert a line break within a field in the data source file. If it’s necessary to split a field across different lines, create two different fields, such as <<Address1>> and <<Address2>>.
You can choose Remove Blank Lines For Empty Fields when merging the document to prevent empty lines. However, if any characters, including spaces, appear on the line, the line is not deleted.
Add image fields in the data source file
By adding image fields to the data source file, you can allow a different image to appear on each merged record. For example, when you merge documents that include information from various companies, you can include an image of each company’s logo as part of the merge.
-
Open the data source file.
-
At the beginning of the data field name, type @ to insert text or paths that refer to image files. The @ symbol is required only in the first line; subsequent lines should include the image paths. Case-sensitive paths must follow the naming conventions of the operating system in which they’re stored.
Tip:If you get an error message when you type the @ symbol at the beginning of the field, type an apostrophe (') before the @ symbol (such as '@Photos) to validate the function. Some applications, such as Microsoft Excel, reserve the @ symbol for functions.
Example of image references in data source file:
Windows
Name |
Age |
@Photos |
Bill Tucker |
36 |
C:\Photos\BillTucker.jpg |
Dat Nguyen |
53 |
C:\MyDocuments\dat.gif |
Maria Ruiz |
26 |
C:\Photos\Ruiz.psd |
macOS (InDesign 19.5 onwards)
Name |
Age |
@Photos |
Bill Tucker |
36 |
/Photos/BillTucker.jpg |
Dat Nguyen |
53 |
/Desktop/Family/dat.gif |
Maria Ruiz |
26 |
/Photos/Ruiz.psd |
Apple has phased out HFS (Hierarchical File System) paths in macOS versions 10.0-10.9. With the latest update, InDesign has transitioned from using HFS paths to POSIX-style (Portable Operating System Interface) paths to ensure compatibility with future macOS updates. Though HFS paths will still function in the earlier versions of InDesign, POSIX-path styles is enabled by default with the latest version. Thus, the POSIX-style path would work for absolute paths while referencing images via Data Merge in Mac. Therefore, we recommend replacing HFS style paths with POSIX style in the data source file.
HFS path |
POSIX path |
Notes |
Macintosh HD:Users:labuser:Desktop:1.pdf |
/Users/labuser/Desktop/1.pdf |
Replace the HFS style path with the POSIX style path in the data source file. |
Volumes:Graphics:RGB.jpg |
/Volumes/Graphics/RGB.jpg |
Replace the HFS style path with the POSIX style path in the data source file. |
/<foldername>/<filename> |
<foldername>/<filename> |
Use this syntax for relative path in the data source file. |
../../../../Desktop/1.pdf |
../../../../Desktop/1.pdf |
No changes from the previous version. |
./<foldername>/<filename> |
./<foldername>/<filename> |
No changes from the previous version. |
<filename> |
<filename> |
No changes from the previous version. |
You can use InDesign to view the path of an image on your operating system. Insert an image in an InDesign document, and then use the Links panel to view the image’s location. With the image selected, choose Copy Info > Copy Full Path from the Links panel menu. You may need to edit the path after you paste it in your data source. This technique is especially useful for images on a server.
About target documents
Once your data source file is created, you need to set up the target document and insert the fields from the data source file. The target document contains data-field placeholder text and graphics, such as the design that you want to appear on every postcard. These fields become available to add after you select a data source.
When you merge data, InDesign creates a new document that replaces the fields with the data you designated in the data source file. You can place data fields on either a parent page or a document page.
Select a data source
Before you insert fields into your target document, select a data source in the Data Merge panel. You can have only one data source file selected per target document.
-
Create or open the document you’ll be using as the target document.
-
Choose Window > Utilities > Data Merge.
-
Choose Select Data Source from the Data Merge panel menu.
-
To change delimited text options, select Show Import Options.
InDesign automatically detects the type of delimiter and encoding used in the data source file, so showing the import options usually isn’t necessary. However, you can specify different encoding and delimiter options if you think they haven’t been correctly identified.
-
Locate the data source file, and click Open.
-
If you selected Show Import Options, change the delimiter and encoding options as necessary, and then click OK. The data fields appear in the Data Merge panel.
If an alert message indicates that it cannot open the file, or if incorrect fields appear in the list box, you may need to edit the spreadsheet or database file and save it as a comma-delimited, tab-delimited, or semicolon-delimited file.
Once the data source is selected and fields are loaded in the Data Merge panel, any changes made to the data source are not reflected in the target document until you update the data source.
Insert data fields
When you select the data source, a list of data field names appears in the Data Merge panel. These names are identical to the column heads from the data source file. Icons indicate whether the field is text or an image. When data fields are added to your document, they become field placeholders, such as <<Company>>. You can select and format these placeholders as you would any other text or graphic.
You can assign an image field to an existing frame to create a floating image. Or, if the insertion point is in a text frame or if text is selected when you insert an image field, a small placeholder is inserted as an inline frame. You can resize the image placeholder to determine the size of the merged images.
Once you insert a data field, InDesign remembers its data source. Any errors in the list of fields, such as typos, empty fields, and unintended field types, must be corrected in the source application and then updated using the Data Merge panel.
Insert a text data field in the target document
-
Create a text frame on a document page or parent page.
If you’re adding data fields to a parent page, see Adding data field placeholders to parent pages.
-
Place the insertion point in the text frame where you want the field placeholder to appear, or select the text you want to replace.
-
To insert a field placeholder, do one of the following:
Click a field in the Data Merge panel list.
Drag a field name from the Data Merge panel list, and drop it onto the text frame to add the placeholder. If you drag a text field onto an empty frame, the empty frame becomes a text frame.
Text field placeholders appear in the target application within double angle brackets (such as <<Name>>) using the current formatting attributes (such as font and size).
You cannot create a valid field by simply typing the field name or editing an existing field. You must insert it from the Data Merge panel.
Insert an image data field in the target document
- To insert a new inline graphic placeholder, drag an image field onto a text frame, or place the insertion point in a text frame and click the image field.
- To insert a new floating graphic, drag an image field onto an empty frame or existing graphics frame. If you drag an image field onto an empty frame, the empty frame becomes a graphics frame.
- To insert a field into grouped items, table cells, or
nested items, drag the image field onto the target.
Image field placeholders appear as frames containing the field name.
Add QR code
You can integrate a QR code in the merged document. Following are the different types of QR code fields that can be added via a Data Merge workflow:
- Plain Text
- Web Hyperlink
- Text Message
- Business Card
To generate the QR codes the data entries in the .txt or .csv files, which are used as Data Sources, are in the following format with a # sign on their column name:
- Plain Text: In the QR code Column enter the text as it is.
- Web Hyperlink: URL:<url> (For example “URL:http://www.google.com”)
- Text Message: SMSTO:<Phone number>:<Message> (For example: “SMSTO:9818143551:Hi”)
- Email: MATMSG:\nTo:<email address> (example: “MATMSG:\nTO:johndoe@adobe.com\nSUB:Hi;\nBODY:;;”)
- Business Card: "BEGIN:VCARD\nVERSION:2.1\nN:Smith;John\nFN:John Smith\nORG:Adobe\nTITLE:Engineer\nTEL;CELL:+919876543210\nTEL;WORK;VOICE:123456789\nADR;WORK:;;Street ABC;Seattle;Washington;98101;US\nEMAIL;WORK;INTERNET:abc@adobe.com\nURL:www.adobe.com\nEND:VCARD"
The data entries can be a mix of email, sms, hyperlink, or plain text type. To generate QR codes, follow these instructions:
-
Select Windows > Utilities > Data Merge.
-
From the flyout menu, select Select Data Source.
-
Select the data file with the QR field information. Click Open.
-
Select the placeholder in the document.
-
Click Create Merged Document icon to create a merged document.
Adding data field placeholders to parent pages
If you insert data field placeholders on parent pages, you have advantages that are not available when you insert placeholders on document pages:
The resulting merged document contains the original placeholders on its parent pages and includes the merged results on document pages as overridden parent page items.
The merged document maintains a connection to the data source, so if records in the data source are modified, you can update the merged document contents by choosing Update Content In Data Fields. This option is especially helpful if you change the layout in the merged document and then need to add new data from the data source.
The settings in the Create Merged Document dialog box are the same as those used in the target document, so you can quickly re-create the current document with the same appearance. You can also use these shared settings to create an identical document with a different data source, or create a new document with a slightly modified layout.
If you’re adding data fields to a parent page, make sure that the text frame containing the data fields allows parent item overrides. Select the text frame on the parent page and choose Allow Parent Item Overrides On Selection from the Pages panel menu. If this option is not selected, the data will not be merged. (See Create parents.)
You cannot place data fields on both parent pages and document pages. To merge properly, you must apply a parent containing data fields to the first page of the document.
If an error message indicates that InDesign cannot merge the document because no placeholders are present, you may have added the placeholders to the left parent page in a one-page document. Page 1 is based on the right parent page, so add the placeholders to the right parent page.
Update, remove, or replace data source files
- To update data source files, edit and save the data source file in comma- or tab- or semicolon-delimited format, and then choose Update Data Source from the Data Merge panel.
The changes will be reflected in the Data Merge panel. If the changes are not reflected in the document after updating, deselect Preview to turn it off, and then select Preview again to turn it back on.
- To remove the connection to the data source file, choose Remove Data Source from the Data Merge panel menu.
- To switch to a new data source file, choose Select Data Source from the Data Merge panel menu, and then specify the new data source file. InDesign may not recognize some of the fields. In this situation, it’s best to delete and reinsert placeholder fields.
If you generate a merged document from a target document in which data fields appeared on parent pages, you can update the data fields in the merged document.
Preview records in the target document
Before you merge the target document and data source file, it’s a good idea to preview the records to make sure that field data will appear properly when the information is merged. When you preview records, the Data Merge panel displays actual data from the data source file instead of the field placeholders. For example, instead of seeing <<Company>>, you might see Adobe. You can use the navigation buttons on the Data Merge panel to cycle through the records.
If you find problems with any of the records, such as typographical errors or extra spaces, it is recommended that you edit the source file in its original application. (See About data source files.)
-
Click Preview at the bottom of the Data Merge panel, or choose Preview from the Data Merge panel menu.
-
Click the navigation buttons to cycle through data from different records.
To go to a specified record, click the navigation buttons at the bottom of the panel. You can also type the number of the record you want to preview in the navigation text box at the bottom of the panel, and then press Enter or Return.
Switching preview on or off
Some issues may arise or correct themselves when you switch between previewing modes. Keep the following in mind:
Placeholders replace the preview content when the Preview Record option is not selected. If you delete an image as well as the frame containing the image, or delete a whole text string, when you deselect the Preview Record option, the placeholders will not appear as they have also been removed.
Changes in the Content Placement Options dialog box are not reflected until you click OK. Also, if the Preview Record option is selected, the data will not reflect the updated placement settings until you deselect and select the option again.
If you try to save the document in preview mode, you will receive a message prompting you to turn off preview mode before saving your document.
Edit data field placeholders
When you add a text data field to a document, the placeholder text for the field is entered using the formatting attributes (such as font and size) active at the insertion point. You can then edit the placeholder text’s attributes to control the look of the actual data.
-
Do one of the following:
To change placeholder attributes, select the placeholder text, and then change the formatting attributes as you would with other text.
To change a placeholder, select the placeholder or the actual data, and select a different field name in the Data Merge panel.
To delete a placeholder, select the placeholder and press Backspace or Delete.
In Story Editor view, text placeholders are displayed in the same way as hyperlinks. Some Data Merge panel options are not available in Story Editor view.
Set content placement options
Use the Content Placement Options dialog box to specify the default settings for the current document or for all future data merge projects. You can specify how the image is placed, whether images are linked or embedded, whether blank lines are removed for empty fields, and the maximum number of records for each merged document.
-
Do one of the following:
To affect only the current document, open the target document.
To affect all future documents you create, close all documents.
-
Choose Window > Utilities > Data Merge.
-
Choose Content Placement Options from the Data Merge panel menu.
-
Change the content placement options. (See Content placement options.)
-
Click OK.
Merge records
After you format the target document and insert fields from the data source file, you’re ready to officially merge the information from the data source with the target document. You can merge the records to another InDesign document or directly to PDF. When you merge, InDesign creates a new document or PDF based on the target document, and replaces the fields in the target document with the appropriate information from the data source file.
When you merge a document that includes data field placeholders on parent pages, those parent page items will be copied into the parent pages in the newly generated document.
Merge single or multiple records
-
With the target document open, do one of the following:
Choose Create Merged Document from the Data Merge panel menu, or click the Create Merged Document button .
Choose Export To PDF from the Data Merge panel menu.
-
On the Records tab, for Records To Merge, select All Records to merge all the records in the data source file, select Single Record to merge a specific record, or specify a Range of records to merge.
-
For Records Per Document Page, do one of the following:
Choose Single Record so that each record starts at the top of the next page.
Choose Multiple Records to create more than one record per page. (For example, to print mailing labels.)
You cannot merge multiple records if the data fields appear on a document page in a document with multiple pages, or if data fields appear on multiple parent pages.
-
Select Generate Overset Text Report With Document Creation to automatically open a report that tracks overset conditions created during the merge of the data into the InDesign document. (See Overset text reports.)
-
Select Alert When Images Are Missing to display a missing link alert when one or more images are not available.
-
If you selected Multiple Records on the Records tab, click the Multiple Record Layout tab, and specify the following:
For Margins, type values to specify the distance between margin guides and each edge of the page.
For Layout Of Records, select either Rows First or Columns First, and then specify the spacing between the columns and rows.
-
If you selected Multiple Records, select Preview Multiple Record Layout to review changes made in the Create Merge Records dialog box. You can click the Page buttons to navigate the records.
-
Click the Options tab and specify the placement options. (See Content placement options.)
-
When you’re finished, click OK.
-
If you’re exporting directly to PDF, specify PDF options, and click Export. Then specify the filename and location, and click Save. (See Adobe PDF options.)
If the data source file points to any unsupported file formats or images that are not available, you may need to correct the data source file to point to a supported file, correct the path to any missing file, or simply move the file to the correct folder so that InDesign can find it and place it.
Limitations for merging multiple records
You can choose Multiple Records to create more than one record per page. For example, if you are printing mailing labels, you want to print more than one label per page. The way records appear in the merged publication depends mainly on the layout options. Here is a list of limitations you might encounter when using the Multiple Records option:
You cannot merge multiple records if the data fields appear on a document page in a document with multiple pages, or if data fields appear on multiple parent pages.
The Data Merge allows for only one size of place holder.
Deleting a record in the merged publication will not reflow the remaining records into the empty placeholder.
Merging to a PDF file
When you merge to a PDF file, all the options are the same as when you create a merged InDesign document. The resulting PDF takes advantage of PDF XObjects for the static parts of the page, resulting in a reduced-size, efficient PDF.
Update data fields
After merging a document with data placeholders on parent pages, you can change the layout of the merged document and still update the values of data fields in the data source. Use the Update Data Fields to update the data fields while maintaining the layout of the document. This option is available only in a merged document in which data placeholders appear on parent pages.
-
Make any changes to the data source file, and then save and close the data source file.
-
In the merged document, choose Update Data Fields.
The changes that have been made by updating the data fields appear in a log file.
This option works best when you simply edit or add records in the data source file. If you add placeholder fields, add new fields to the data source, or change the settings in the Create Merged Document dialog box, use the Create Merged Document option to generate a new merged document.
Overset text reports
The Overset Text Report appears if the Generate Overset Text Report option is selected in the Create Merged Document dialog box, and if one or more fields include overset text after the data is merged.
The report displays each overset instance in a numbered list showing the page number the text appears on, overset character/word count and a snippet of the overset text.
If the report appears when you create a merged document, use the report to fix the overset condition. For example, you may want to increase the text frame size, decrease the font size, or edit the text.
Content placement options
The following options appear in the Content Placement Options dialog box:
Fit Images Proportionally
Maintains the image’s aspect ratio but scales the image to fit within the frame (default).
Fit Images To Frames
Scales the image so that its aspect ratio is identical to the frame’s aspect ratio.
Fit Frames To Images
Preserves the image size but adjusts the frame size to match it.
Preserve Frame And Image Sizes
Places the image at its intrinsic size into the frame, aligned to the upper-left corner of the frame. The image is cropped if too large for the frame.
Fill Frames Proportionally
Places the image so that its height or width fills the frame, leaving the rest of the image cropped.
Content-Aware Fit
Automatically fits an image inside the frame based on the image content and frame size.
Use Existing
Applies the existing individual frame fitting option for image frames. This option is useful when you want to choose an already existing fitting on the destination frame.
Center In Frame
Aligns the center of the image to the center of the frame. This option is disabled if you have selected Content-Aware Fit as the fitting option.
Link Images
Creates a link, or file path, to the original image file. If this option is not selected, all image data is embedded in the InDesign document.
Remove Blank Lines For Empty Fields
Remove paragraph returns inserted for empty fields. This is especially useful for mailings in which you have an optional address field. This option ignores soft returns. If any characters, including spaces, appear on the line, the line is not deleted.
Record Limit Per Document
Specifies the maximum number of records for each merged document. When this threshold is reached, a new document is created. This document has the number of pages necessary to hold the remaining records being merged (up to the per-record limit). This option is available only when Single Record is selected.
Page Limit Per Document
Specifies the maximum number of pages for each document. When the threshold is reached, a new document is created with the number of pages necessary to hold the remaining records being merged (up to the per-page limit). This option is available only when Multiple Records are selected from the Records Per Document Page menu when merging.
More like this
Have a question or an idea?
We would love to hear from you. Share your thoughts with the Adobe InDesign Community.