Help

Re: Concatenated text field > Showing line breaks in text in CSV export format

2111 2
cancel
Showing results for 
Search instead for 
Did you mean: 

My table provides data which I need to export into CSV and then import into an online application. My text shows line breaks (using the “\n” code in the text in Airtable). The issue is this code may not be interpreted by online applications that do support HTML or plain text format. Some online forms do interpret it as pre-formatted text, but most of them don’t. So text that shows with line breaks in Airtable (thanks to the “\n” code) will show only as a merged text when imported and all is in one line without any breaks.

This was asked here previously with recommendation to add HTML or CSS code. Adding the regular line break code can be messy if you have concatenated formulas for output text coming from different fields. I would have to add <__br/> and <p> </p> after every individual block of text in Airtable concatenated formula. If it is a nested formula with text input coming from multiple other fields, this can become a big task. Then making any changes will require a lot of effort to reformat things again.

To ensure the line breaks show in the imported HTML text, I added code <pre> at the beginning of my concatenated formula and </pre> at the end.

Example:

This is the text I have showing in Airtable…

The quick brown

fox

jumps over the lazy

dog.

And this is the field formula:
“The quick brown “&”\n\n”&{ANIMAL1}&"\n\n"&“jumps over the lazy “&”\n\n”&{ANIMAL2}&"."

Where
ANIMAL1 = fox
ANIMAL2 = dog

If I was doing export in CSV and import into another application, the resulting text would be all in one line:

The quick brown fox jumps over the lazy dog.

That may work for this pangram but not for my needs. I want to show the line breaks.

To do that, I added the code <pre> at the beginning and </pre> at the end.

“<pre>"&“The quick brown “&”\n\n”&{ANIMAL1}&"\n\n"&“jumps over the lazy “&”\n\n”&{ANIMAL2}&"."&"</pre>”

Exported CSV looks like this:

<pre>The quick brown fox jumps over the lazy dog.<_/pre>

(It’s without the underscore __ … I had to add it here because this page here interprets it as preformatted text and wouldn’t show the code in the text.)

Now when I import my CSV in the online application it will understand this is a pre-formatted text and it will treat the line breaks in the CSV text as HTML line lines code, which is also “/n” but it is not interpreted unless there is a code <__pre>.

This may be an alternative answer to this question:

4 Replies 4

Hello!
Okay… I’m a bit confused after reading over your post a few times.

To get some quick clarification:

  1. What do you want to achieve?
  2. What are you trying now?
  3. What results are you getting now?

Any additional context would be greatly appreciated!

Perhaps I should clarify the intent of this post and for whom this is intended. I do not have a question. This is a tip for people who have the same issue.

The issue is inability to port line breaks into 3rd party apps via the CSV file from Airtable.

You create CSV export and try to import into 3rd party online services, many of them will import the text as one long string of text without any line breaks. Meaning the 3rd party apps do not take into consideration the line breaks in CSV, even though you have line breaks in your Airtable text fields.

By adding the

 and 
code you indicate, the content is preformatted text. The 3rd party tool will correctly understand it needs to leave the line breaks untouched and it will import with line breaks.

95% of online services have this issue. I tried many and took me a while to find the solution that is simple and effective.

If you don’t need to move data between Airtable and 3rd party apps, then you can disregard this post.

Makes sense?

Thank you for this idea…I’m running into this problem while I’m trying to use Airtable Automations to update a Google Calendar event DESCRIPTION field. The long description has airtable’s /n line breaks, so I think GCal is rejecting the entire field.

Basically I’m sending GCal the description field with the airtable formatted text, but then the resulting GCal event description comes up blank.

I tried adding the

 and 
tags, but nothing happened.

Any other ideas?

Have you tried Integromat, Zapier and other automation tools? They have some text manipulation tools integrated. Also there are tools like https://cloudconvert.com that may help together with the Automation. That could be a way out maybe…

You will likely need to reformat the rich text of your long description before it goes to Calendar. Have you tried to put the

 code as I mentioned above into your long text? Just make another concatenated field like "<pre>"&YOURLONGTEXTFIELD&"</pre>" … or something like that and see what happens?