Take the 2-minute tour ×

I get the feeling that I do not really want Data merge, but something similar... I want to merge a .csv file into my InDesign document, have it formatted in a similar way as if I was using Data merge, but then generate the all the records at once and dump them into the document. Is this possible?

The application is for having a member phone list. We have generated a .csv from the membership system, but we then want it all in a big list in our newsletter. For instance, given the first two rows of the csv is

First name,Last name,Phone number
Carl,Pettersson,123 45 67
John,Doe,234 56 78

I would like to specify a template

<<First name>> <<Last name>>
<<Phone number>>

And apply styles and whatnot, then have inDesign either create a lot of individual text frames, or paragraphs within a single frame, giving an end result something like this:

Carl Pettersson
123 45 67

John Doe
234 45 67

This would be generated directly, not via "Generate merged document", preferably. Is there such a feature?

share|improve this question
I can see what I can do sometime this week at work. Might take a few days but I work on phone books and we have it all setup to do a fair chunk of it automatically. –  Ryan Sep 16 '12 at 20:02
add comment

3 Answers

up vote 2 down vote accepted

I would do it with scripting. This source shows how to take a text file that's tab-delimited and turn that file into an array that you can script with. I adapted it to a text file that was delimited by carriage returns instead of tabs, but commas would also be adaptable.

Once you have the data in an array, then you can place it into the document however you want. You can define documents, paragraph styles, text frame, and everything in code, or you can create a template file and link your data to it via script labels, layer names, or even story contents.

share|improve this answer
I went with scripting in the end, wasn't as hard as I thought. Thanks! –  carlpett Sep 23 '12 at 20:04
add comment

I don't know if there's a feature per se, but I can tell you how I used to do it. It's a bit lengthy, but it works. These instructions are from IDCS4 and an older version of Word, so the functions may have moved around a but.

1) Start with your data

If you start in Excel:
a) Each line of data (name, company, location) should be in its own column.
b) Export as tab-delineated text.
c) Open in Word.

Once you are in Word:
d) Each line of data should be separated by a tab. It should look something like this:

John Smith  Morgan Stanley  Purchase          Marketing
Jane Doe    Dreyfus         New York City

2) Find/Replace

Find a tab (^t) and replace it with a return followed by a nonsense string (^pxxx). ONLY REPLACE THE FIRST TAB. Skip tabs (that is, click “Find Next” rather than “Replace”) until you are at the first tab of the second line.

When you have replaced all the first tabs, choose a different nonsense string (^pyyy). ONLY REPLACE THE SECOND TAB.

Repeat for however many columns you have. Your end result should look like this:

John Smith
xxxMorgan Stanley
Jane Doe
yyyNew York City

3) Style in Word

a) Select all your data. Change the font to Verdana. (This is arbitrary — you’re just doing something to make it a style. Don’t worry about how it needs to look in InDesign for the moment.)
b) Format→Style. Click the “new” button. Make up a name (Name_Style). Click OK. Click Apply. This makes all your data the first style.
c) Select only your second line of data (the one which starts with XXX). Change the font to Times. (Again, this is arbitrary — you want to be able to see that each style is something different.)
d) Format→Style. Click the “new” button. Make up a name (Company_Style) . Click OK. Click Apply. Repeat for however many different lines of data you have (name, company, location).

4) Find/Replace

a) In the dialogue box, click on the Replace button so the Replace options come down.
b) Click on the arrow at lower left so all the extras come down.
c) In the Find field, type your first nonsense string (xxx). DO NOT include the return character of ^p.
d) Click on the dropdown menu which starts with “Format.” Select “Style” and choose your first style (Name_Style).
This selects all the Company names which are in Name style. (The goal is to change all the Company names, which start with xxx, to Company style, but right now everything is in Name style.)
e) In the Replace field, make sure there are no characters (put the cursor in and hit delete). This step will remove the nonsense string.
f) Click on the dropdown menu which starts with “Format.” Select “Style” and choose the style which that line is supposed to be (Company_Style).
g) Click Replace All.

Your text should now look something like this:
John Smith
Morgan Stanley
Jane Doe
yyyNew York City

The company name is now in the new Company_style (which has a different font) and the XXX nonsense string is removed.

4h) Repeat these steps for any other columns. Your text will end up something looking like this:

John Smith
Morgan Stanley
Jane Doe
New York City

Save and close.

5) Import into InDesign.

a) Create your master page with text boxes, and set up your paragraph styles (Name, Company, etc.). The text boxes should be tight to the text — do not leave extra space hanging below where your text is supposed to end.
b) Drag down TWO pages based on the master page. Unlock the text box on each (shift-apple-click).
c) File→Place
d) Select the Word document. In the lower-left-hand corner of the dialogue box, make sure “Show Import Options” is checked.
e) At the bottom of the next dialogue box, click the radio button which says “Customize Style Import.” The “Style Mapping” button will become clickable. Click it.
f) The Word styles will show up on the left. Scroll to your styles and replace the Word style (Name_style) with the appropriate InDesign style (Name). Click OK twice.
g) The text will start in the text box on the first page and give you an overflow red box. Click that.
h) HOLDING DOWN THE SHIFT KEY, click on the text box on the second page. Holding down the shift key will force InDesign to add a new page every time the text box is filled.
i) WHOMP. Save.

share|improve this answer
Solid advice. 2 possible refinements: (1) You can also use GREP styles to cut out the Word portion: see ( graphicdesign.stackexchange.com/questions/6996/… ). (2) you might be able to avoid the find'n'replace in the data file by, say, exporting xml or opening the csv with access (or random database program) and some creative sql. –  horatio Sep 18 '12 at 20:27
As I noted, this was for an old version of ID, and I hadn't used GREP styles then -- I happened to have this set of instructions already written up for my officemates. But I will take your advice if I find myself doing this kind of task again. –  Lauren Ipsum Sep 19 '12 at 1:06
add comment

I would go ahead and use Data Merge for a simple case like this, but there is a way to do it without that. This is based on your two-line layout.

  • Set up paragraphs styles for Name and Phone just as you would do for a merge, but in the Name style, specify Phone as Next Style, and in the Phone style, specify Name as Next Style.

Paragraph Style dialog

  • In the first text frame Place (or paste) your csv. Delete the first line, which has the field names. Ignore any overset text warnings from here on.

  • Run a grep search/replace using ,(?=\d+.+) in the "Find what" field and \r in the "Change to" field. This replaces every comma that is followed by numbers and spaces with a single paragraph return.

grep search

  • Replace the remaining commas separating first and last names with space or tab depending on your need. Note that the Name paragraph style will need a tab stop defined, if you want to use that.

  • Select the text frame.

  • Right-click the Name paragraph style in the Paragraph Styles panel and choose "Apply Name then Next Style." All your names are now in the Name style and all the phone numbers are in the Phone style.

  • If you have overset text, go to the next page and Cmd/Ctl-Shift-click the next text frame if you're not using CS6 or it is not a Master Text Frame on the Master Page.

  • Click the out port of the first text frame and Shift-click in the new one to fill it and create any additional pages.

share|improve this answer
add comment

Your Answer


