|
|
Data mergeContents [Hide]About data mergeTo create form letters, envelopes, or mailing labels, you merge a data source file with a target document. Data merge is also referred to as mail merge. 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) or a tab-delimited (.txt) 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. ![]() Data merge
Basic steps for merging data1. 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 will be mailed to customers, you might want to use the following data fields: <<Company Name>><<Address>><<City>>, <<State>><<Postal Code>> Your spreadsheet or database might look like this: ![]() Sample data file 2. Save the data source file—usually a spreadsheet or database file—as a comma-delimited (.csv) or tab-delimited (.txt) 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 master page. If you add data fields to a master page, you have additional options. For more information, see Insert data fields and Adding data field placeholders to master 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 filesThe 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) or tab-delimited (.txt) text format. Check your source application’s user guide for more information on exporting to these formats. In a comma- or tab-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 refer to images on disk. Example of comma-delimited data source fileName,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 fileBy 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 may want to include an image of each company’s logo as part of the merge. (Windows) Example of image references in data source
file
(Mac OS) Example of image
references in data source file
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 Utilities > 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 documentsOnce 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. ![]() The target document includes fields from the data source with
field placeholder text shown. 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 master page or a document page. Select a data sourceBefore 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. Note: 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 or tab-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 fieldsWhen 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 documentText field placeholders appear in the target application within double angle brackets (such as <<Name>>) using the current formatting attributes (such as font and size). Note: 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.
Adding data field placeholders to master pagesIf you insert data field placeholders on master pages, you have advantages that are not available when you insert placeholders on document pages:
Note: If you’re adding data fields to a master page, make sure that
the text frame containing the data fields allows master item overrides.
Select the text frame on the master page and choose Allow Master
Item Overrides On Selection from the Pages panel menu. If this option
is not selected, the data will not be merged. (See Create masters.)
You cannot place data fields on both master pages and document pages. In order to merge properly, you must apply a master containing data fields to the first page of the document. Important: 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 master page in a one-page
document. Page 1 is based on the right master page, so add the placeholders
to the right master page.
Update, remove, or replace data source files If you generate a merged document from
a target document in which data fields appeared on master pages,
you can update the data fields in the merged document.Preview records in the target documentBefore 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 Systems, Inc. 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.)
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 offSome issues may arise or correct themselves when you switch between previewing modes. Keep the following in mind:
Edit data field placeholdersWhen 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:
Note: 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 optionsUse 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.
Merge recordsAfter 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 master pages, those master page items will be copied into the master pages in the newly generated document. Merge single or multiple records
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 recordsYou can choose Multiple Records to create more than one record per page. For example, if you are printing mailing labels, you'll want to print more than one label per page. The way the records will 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:
Update data fieldsAfter merging a document with data placeholders on master 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 master pages.
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 reportsThe 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, followed by 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 optionsThe following options appear in the Content Placement Options dialog box:
|