Hi!
As we all know importing files is sometimes a nice challenge. We managed it to import CSV Files with columns > 1024.
I talk about standard CSV
http://en.wikipedia.org/wiki/Comma-separated_values
Everything worked fine up to the point we got a file with line delimiters in the columns.
As Example
Working...
1234;"It's a Test;Try this at home!";5678;<CRLF>
"A;BC";DEFG;HIJK;<CRLF>
Error...
1234;"It's a Test;<CRLF>
Try this at home!";5678;<CRLF
"A;BC";DEFG;HIJK;<CRLF>
My solution:
I tried to get the quantity of my column delimiters (") in front of my first found <CRLF>.
If (ColumnDelimiterCounter MOD 2) = 0 :thumbsup: ELSE go on and search next <CRLF> and repeat searching for columnd delimiters.
Any idea for a better workaround?
greetings mik
Comments
When a reserved symbol is used in an import it's normal that it fails, a rule (I decided for myself) is to check the data on reserved symbols before formatting them into csv.
This isen't always required if you use a combination of symbols that seperate fields, namely [ ";" ] (between the brackets[] literal, quotes are part of it)
If you use multiple symbols, the data only has to be checked on that combination. Which decreases the chance of hitting a false positive delimiter.
|To-Increase|
So my result will also be an even number of column delimiters.
I thought it is not the best way to parse this file.
The solution should not modify the file before importing. I also do not want to parse the file before my import. (performance)
(To convert my file (.xls) I use the "Excel Buffer". So I can be sure that I have a standard .csv file. Every Delimiter (column, expression, line) is correct)
http://en.wikipedia.org/wiki/Comma-separated_values
With kind regards
mik
But you mention a standard csv file, however there is no universal standard for that file (only the RFC 4180 since 2005, But that's more of a guideline to people who can't imagine anything with "CSV").
But I just mentioned the colum delimiter because quotes do not always come in pairs: this is different from your example, but you've escaped your quote on "luxurious", which will not happen when using excel to create csv files.
|To-Increase|
in my case i tried this ..
Excel would do this for me ..
In my scenario it should work. An if this is a "standard .CSV" we can tell our customers that we can handle standard .CSV and nothing else! No more need to be afraid of ";" in the column text :-k
With kind regards
mik
The behaviour you describe is not detected when I save using the "csv (ms-dos)" option
|To-Increase|