Mobile app version of vmapp.org
Login or Join
Shelton719

: Data merge "at once" 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

@Shelton719

Posted in: #AdobeIndesign

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?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Shelton719

3 Comments

Sorted by latest first Latest Oldest Best

 

@Hamm6457569

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.





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.





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.

10% popularity Vote Up Vote Down


 

@Chiappetta793

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.

10% popularity Vote Up Vote Down


 

@Speyer780

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
yyyPurchase
zzzMarketing
Jane Doe
xxxDreyfus
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
yyyPurchase
zzzMarketing
Jane Doe
Dreyfus
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
Purchase
Marketing
Jane Doe
Dreyfus
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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme