Preserve Line Breaks in Exported CSV

By: Michael Clark | Asked: 06/05/2024
ForumsCategory: How-toPreserve Line Breaks in Exported CSV
Michael ClarkMichael Clark asked 2 months ago

Here's the rub..

  • Table View column has a
    [foreach][id] [id] line break here as an html br tag[/foreach]
  • Export as CSV doesn't preserve the line break
  • Need that line break in that column of the exported CSV

..anybody have a hack for preserving line breaks in a CSV export?

1 Answers
Rob LeVineRob LeVine answered 2 months ago
Have you tried using something like frm_export_content to replace the HTML br tags with \n or similar?
Michael ClarkMichael Clark replied 2 months ago

Rob, thanks for the suggestion. I'll check it out.

Michael ClarkMichael Clark replied 2 months ago

No change. I think since it's stripping out the tag, it's not going to work. Also this is for exporting a View table to CSV. The line break is in a [foreach] shortcode, so I'm not sure where it's blowing it out. Grrr..

Rob LeVineRob LeVine replied 2 months ago

Interesting. I just created at form with a repeater field and in the repeater section I put a paragraph field and added an entry with the HTML line breaks and the view exported the paragraph field with the new lines. I know that's not the same as what you're doing, but it at least means the export respects the HTML new lines.

Michael ClarkMichael Clark replied 1 month ago

Thanks, @Rob. What your test seems to imply is that Formidable's view export respects html line breaks in the long text (paragraph) form field, but not html line breaks in the view itself. So technically, the export does not respect html line breaks unless they're in the form entry. My use case doesn't have a paragraph field in a repeater. My use case formates the [foreach] so each row is separated by an html line break, which gets stripped out no matter what I do.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right