Forum
Downloading form CSV problems caused by commas...
I'm on Perch 2.8.34 with Forms app 1.8.3...
We have a form with a text field on it, when the visitor enters a comma in the course of his message, throws off the CSV outputs as the commas are read as field delimiters.
Is there a way to work around this? or is it a bug?
thanks for your help, Monty
The values should be quoted. Is it a number field?
no, a textarea.
Here's an actual example of text in that field that's getting split up:
I've added
**^**
characters where the CSV output text is getting broken into additional fields.So, I was wrong, it's not commas... It seems to be getting thrown off by the return after the close paren? and then starts outputting the returns.
Is it using CR or LF?
how would I tell?
Probably not easily. I'll take a look at the code.
ok. so thinking it was the line returns that was throwing off the data in the CSV output, in
responses.export.pre.php
I changed:to
Does that seem like the right solution? Seems to work. -- Monty
That would take the line breaks out entirely, rather than escaping them. It will depend what you're importing into, as CSV isn't actually a standard.
But leaving the line breaks in breaks the CSV output, no?
For me, this is a better solution, but what you're saying is it wouldn't necessarily be better for everyone, right?
It depends where you're importing it to, as CSV is not a standard.
ok. got it.
So best solution would be to make a change to the form app file and, as the form app gets updated, remember to bring the change over, too.
Because in this case, the CSV needs to be read into a spreadsheet and line returns in text fields interfere with that.
I'm struggling to muster up enough interest in CSV files to form an opinion. You should probably just do what works for your purposes.
Ha! Well, it took me quite a bit of mustering to even mention it! :)