Is there a way to include commas in CSV columns without breaking the formatting?

Posted by editor on Stack Overflow See other posts from Stack Overflow or by editor
Published on 2011-01-06T17:47:01Z Indexed on 2011/01/06 17:53 UTC
Read the original article Hit count: 171

Filed under:

I've got a two column CSV with a name and a number. Some people's name use commas, for example "Joe Blow, CFA." This comma breaks the CSV format, since it's interpreted as a new column.

I've read up and the most common prescription seems to be replacing that character, or replacing the delimiter, with a new value (e.g. "this|that|the, other").

I'd really like to keep the comma separator (I know excel supports other delimiters but other interpreters may not). I'd also like to keep the comma in the name, as "Joe Blow| CFA" looks pretty silly.

Is there a way to include commas in CSV columns without breaking the formatting, for example by escaping them?

© Stack Overflow or respective owner

Related posts about csv