Copy link to clipboard
Copied
I am using a .csv file as a dataset. Each cell in the .csv file contains a list of 30 words, separated by a line break. (That's what I need.) By using the plus button, the text frame in InDesign is divided into three sections.
When I separate my words in Excel with a space, the dataset displays them almost correctly (The problem with using spaces is that InDesign will put two words on the same line if they fit, and I need each word on a separate line.) However, when I have a break line after each word, then InDesign creates a new document for each word of each cell.
How do I fix this?
Hi @zvi_t ,
see my first post above. There you have the solution. Quoting myself:
"replace the space after every word with a character or a combination of characters you do not use elsewhere in your data and in your InDesign layout."
That's it. It's not a genuine issue with InDesign.
It's the nature of text based data sources.
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
Hi@zvi_t ,
replace the space after every word with a character or a combination of characters you do not use elsewhere in your data and in your InDesign layout. Do that in your Excel file. After the merge replace that character with a line or paragraph break. Something like &§& could do as substitution. Use TEXT Find/Replace or GREP Find/Replace to replace the sequence of characters all over the place in one InDesign document or all open documents.
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
It's a cute workaround, but I don't think I would want to permanently implement it into my workflow. I'm sure there's a more efficient wayy to accomplish this.
Copy link to clipboard
Copied
I'll just write a script to do this "replace with" thing.
Copy link to clipboard
Copied
There is no easier way.
Copy link to clipboard
Copied
@zvi_t said:
"I'm sure there's a more efficient wayy to accomplish this. "
Don't think so. The data source for a data merge is always some kind of text, no formatting.
"I'll just write a script to do this "replace with" thing."
For InDesign or Excel?
Ok. There could be a way to solve the issue on the InDesign side:
If every white space, blank character, should enforce a line break, you could do a GREP Style in the applied paragraph style with a very large width by using a character style that changes the percentage of the width and changes the value of tracking. Tracking 10,000 and horizontal scaling of 1000%.
Here a sample where I use 10,000 for tracking and 500% for scaling every blank character in the paragraph:
GREP Style pattern is:
\x{0020}
That's a blank at Unicode code point 0020.
So the automatism is in the applied paragraph style, the line breaks are done with formatting and not with a special line break or paragraph break character.
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi @zvi_t ,
do you see a general rule when a line break should occur?
Every two words for example?
Such a rule could be mapped to a GREP expression as well.
Another point:
Would it be semantically right to do a line break at a particular position in your text?
Then using blanks would be an error.
Could you show a screenshot of your page with frame edges showing, hidden characters as well and also one of the text frames selected where we can see how the text flow is going? Perhaps there is a totally different way to achieve what you want.
Thanks,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
It's getting ridiculous. For two days now, I've been trying to figure out how to get data from Excel (or Google Sheets) into InDesign via Data Merge, with the correct line breaks, and correct UTF-8 format. (so I don't get things like “.) And it's a nightmare. Each solution I find solves one problem but creates two more.
@LaubenderI have only one line-break rule: every word should be on its own line. I saw a GREP workaround here: https://creativepro.com/controlling-line-breaks-with-data-merge/ but they suggest creating a paragraph style with a 10,000 tracking value, so the outrageous tracking values will shove anything after those spaces onto the next line. This will definitely cause issues in the future, and I don't think it's a smart strategy.
What's up with InDesign not importing data with line breaks? I've seen posts about this issue dating back to 2009. Are there only five people in the world who use line breaks that it's not worth Adobe's time?
As opposed to Word, Excel does not allow me to display formatting marks. I tested this by pasting the data into Word, but I did not find any hidden culprit characters.
This is a screenshot of the three text frames:
Copy link to clipboard
Copied
Hi @zvi_t ,
see my first post above. There you have the solution. Quoting myself:
"replace the space after every word with a character or a combination of characters you do not use elsewhere in your data and in your InDesign layout."
That's it. It's not a genuine issue with InDesign.
It's the nature of text based data sources.
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
But then I can't use the preview. Each time, I have to generate all the documents, and scroll hundreds of pages to find issues. (which I'm constantly finding, like random data getting placed in the wrong data field, or blank pages being randomly inserted, etc.,) instead of clicking on the arrows in the preview window.
Copy link to clipboard
Copied
Preview itself is very buggy and is often the cause of data merge errors (and irrepairable template corruption) . I strongly advocate for never using it. Just run the merge. If there's a problem, fix it and run again.
Copy link to clipboard
Copied
What do you mean "cause of data merge errors?" When you scroll through the preview, you aren't changing any data, and when you click to create documents, it even gets turned off automatically.
Copy link to clipboard
Copied
I mean that the preview may look correct,but the merge will match what you just saw and will have errors. This has been the case forever with daa merge (you can find dozens of posts here about it).
Worse, in my experience, if you use preview and tere is an error that template wi ever merge correctly again and will need to be rebuilt.
Copy link to clipboard
Copied
Ok, got it. And, I can just use SHFT-PG-DN to scroll through the pages. I'll start a new post about UTF-8 issues. Thanks.
Copy link to clipboard
Copied
If UTF-8 is not encoding correctly, try UTF-16.
Copy link to clipboard
Copied
I found a great script that works. Thank you all for your help.
Copy link to clipboard
Copied
Hi @zvi_t, if your problem is text encoding glitches (like your find/change screenshot above shows), you may be able to fix it by opening your text-based file (eg. CSV) in VS Code (free download). Open your text-based file, click on UTF-8 in the bottom right and change to UTF-8 with BOM. Then try data merge again.
- Mark
Copy link to clipboard
Copied
You could try using an XML import workflow.