I just realized I've backed myself into a corner where I"m reading and writing from csv, but now that I've created 100 of the csv's, I realized a few of them have a field that contains a comma.
What's the best resolution?
Is there a convention like encasing the field in special characters like {"..."}, or force a different delimiter like a colon? Just looking to do whatever the standard solution is.
Read/write .csv where individual field contains a comma
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7380
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Read/write .csv where individual field contains a comma
With CSV you should put strings in quotes. Then you'd have no issue:
"this, string", 5, "blue"
That is three fields and CSV/Excel will cope. Without the quotes clearly Excel is going to treat it as 4 fields.
"this, string", 5, "blue"
That is three fields and CSV/Excel will cope. Without the quotes clearly Excel is going to treat it as 4 fields.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?