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: