1. JamesC
  2. General
  3. Friday, February 24 2017, 04:12 AM
I have an issue with exporting data, whether it is in importable or readable format.

Where text areas have been used, there are new line characters embedded in the text. When exporting to CSV, this then appears as separate lines. I am doing a fair bit of mucking about to stitch the records back together for processing.

Is there any setting which will cause the new lines in text areas to be replaced with some code, such as an html <br/> which would mean the export from that field would all be in one row and the record would be much easier to process? I'm sure someone else must have had this issue before, and I am just wondering what I am overlooking?

Alternatively, if there was some kind of end-of-record marker then the file would be easier to process, treating intervening new lines as contents from the text.

Any advice would be much appreciated. I only have 250+ records loaded at the moment, but will have several thousand within a month or two, and it will become increasingly cumbersome.
admin Accepted Answer
Admin
Hi,
CSV format allow new line for values, of course the fields need to be quoted.

Not recommended way
You can override export function to met your needs:
- Copy file from /administrator/components/com_jsn/views/users/tmpl/default_export.php to /administrator/templates/isis/html/com_jsn/users/default_export.php
- Edit new file and add at line 92 this code:
$val = str_replace("\n",'<br />', $val);

This way is not recommended because you change the value of field in your CSV

Recommended way
If you need to parse exported CSV correctly you does not want to write many PHP code then you can use some library like ParseCSV (https://github.com/parsecsv/parsecsv-for-php). Libraries like this allow you to parse with a correct way all CSV files.
  1. more than a month ago
  2. General
  3. # 1
JamesC Accepted Answer
Pro
Thanks for both the suggestions.

I was trying to avoid a code-based solution, perhaps being foolish, since I just wanted to be able to open simply in Excel without having to parse the contents - which I can do anyway in VBA, and that's how I solved problem anyway.

Mainly just wanted to be able to do as simple an export as works with saving from Excel to CSV to update the data.

Appreciate your prompt and useful responses, I'll chew on this to see how best to proceed.
  1. more than a month ago
  2. General
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.