I have an InDesign document which is filled from the data in a CSV file using data merge. The CSV has columns for First Name, Middle Name & Last Name, but some of the data in the CSV isn't filled in - such as Middle Name if the person doesn't have one. InDesign then leaves a physical space when the middle name is missing which is putting a double space between the first and last name when I merge the data. Is there any way to get InDesign to ignore blank cells in the CSV file?

4 Answers 4


Are you sure those spaces exist in your CSV file? They shouldn't.
Did you not manually added the spaces between the fields?
Like this: (dots represent spaces)


It does make sense since you want a space between fields.
A solution (among many possible ones) is to use a grep style to hide a space if followed by another space. Something like this should do the trick:


To create an invisible character style, you can use these settings ("Invisible character style" is just like pancakes: everyone has his own recipe... here's mine ^ ^):
color : [none]
size: 0.1 pt
Tracking: -1000
horizontal scale: 1%

See example below:

enter image description here

  • OMG!!!!! THANK YOU SOOOOOOOOO MUCH!!! Even though your video was in French, it helped me figure out a solution!!!!! If only I had seen it yesterday..... before I went in and manually corrected 5,232 addresses!? Thanks again for your genius!!!!
    – Bonnie
    Feb 13, 2018 at 19:54
  • I need help, i can't read the French!!!! Thank you in advance!!! Feb 1, 2019 at 21:14
  • @ShawnBrandt The video shows dialog boxes from data merge, paragraph style options and character style. Typically the order of the various elements is the same whether using English or French so it should be fairly straight forward if you refer to the software. Do you need help with a specific part?
    – curious
    Feb 2, 2019 at 2:48

You can also merge columns in your excel file and put formula to remove unwanted spacing

=TRIM(A2&" "&B2&" "&C2)

Where A2 is name, B2 is Middle Name and C2 is Surname

Formula for only 2 columns to merge would be =TRIM(A2&" "&B2)


This solution affected the entire text, not just my spaces. I feel this also uses a complicated/messy solution by inserting 'extreme' values to remove the spaces. The better option may be the following:


Paragraph Style Options

I then used -78 for the Tracking on the Character Style to adjust for the extra space on a 10pt font. (This was the only option that I needed to adjust, simple).

Character Style Options

You will have to do your own math to figure out the correct negative tracking value for your font size. Hope this helps someone because the original solution did not work for me. It is possible that with InDesign 18.1 (2023) that GREP function \h(?=\h) no longer works as it used to. (Also possible that I am doing something wrong, but I prefer this cleaner method).


In the Data Merge menu, choose "Content Placement Options", and select "Remove Blank Lines for Empty Fields", then click "OK" - it should work.

  • I'm not trying to remove a blank line, I'm basically trying to remove a double space when the name doesn't contain a middle name or initial.
    – Bonnie
    Feb 13, 2018 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.