kometenstaub / csv-to-md

Batch CSV to Markdown converter.
MIT License
85 stars 6 forks source link

Let a CSV be separated by comma and the cells have multiple values. If a value has commas, then don't split it #14

Open ooker777 opened 2 years ago

ooker777 commented 2 years ago

For example, if I have:

key,value
Alice,"value1,value2,"value,3,with,comma""

then the output will be

Alice:: [[value1]] [[value2]] [[value,3,with,comma]]

not

Alice:: [[value1]] [[value2]] [[value]] [[3]] [[with]] [[comma]]

This can even be trickier if the value also have double quote in it, e.g. value,"4",with,comma will be written in the CSV as "value,""4"",with,comma"

kometenstaub commented 2 years ago

Did you test that on real data? I'd have to confirm that myself, but it should strip all quotes and just split at the commas in that case.

ooker777 commented 2 years ago

I'm so sorry for replying late. But yes, I got that on real data