Closed axi92 closed 5 years ago
Well, you could set the relax_column_count
option, .... in french we would say "reculer pour mieux sauter" which translates like "to take a step back to better jump into more mess". Dont know what to say. Of course, a solution would be to implement a rule like treat start quotes only if after delimiter and end quotes only before delimiter but it would be very hard to implement, very dirty for a theorically non valid CSV data (I wrote theorically because CSV lack some specifications). In your case, since you seems to be able to rely on a rule like "only my first column could contains quotes", a quick and dirty fix would be to reconsolidate your data after parsing:
parse = require 'csv-parse'
parse """
"Labirinto, "a" Schoenbrunn",48.182497,16.309359,2,E
""Mann" und Frau",48.178537,16.264381,4,R
""",
quote: null
delimiter: ','
relax_column_count: true
, (err, records) ->
records = for record in records
[record.slice(0, record.length - 4).join(''), record.slice(record.length - 4)...]
console.log records
[
[ '"Labirinto "a" Schoenbrunn"', '48.182497', '16.309359', '2', 'E' ],
[ '"Mann" und Frau"', '48.178537', '16.264381', '4', 'R' ]
]
Closing due to lack of activity.
I have this set of data:
There are 2 Problems, the
"
inside the "" and the,
inside the ""The first one is working with
quote: null,
But I tried to set thedelimiter: null
but that did not work...Output: