parsing CSV files with quotes

Chris Ryland cpr at emsoftware.com
Fri Mar 31 20:32:06 CEST 2000


As far as I know, dealing with CSV files for 10 years now, backslashes are
*never* used for quoting by the major spreadsheets/databases. But I could be
wrong. ;-)

Doubled quotes are *supposed* to work. Why not try putting some double
quotes in a cell and exporting with Excel to see how they're quoted?
--
Cheers!
/ Chris Ryland, President / Em Software, Inc. / www.emsoftware.com

"Al Christians" <achrist at easystreet.com> wrote in message
news:38E4C603.7459B4B5 at easystreet.com...
> Bob Alexander wrote:
> >
> > Here's a Python module I wrote to manage CSVs, and I think it handles
the
> > cases you care about:
> >
> > ------------------- CSV.py ---------------------
> > #
> > # Functions for handling comma-separated value (CSV) files
> > #
> > # Lines of a CSV file are represented by lists of their fields.
> > # Fields are represented as strings.
> > #
> > # Comments on handling of special characters in CSV:
> > #
> > # - Output fields are quoted only if text contains quote or comma
> > # - Quotes in quoted text are doubled
> > # - Quote after first char treated as normal text
> > #
> >
>
> Is there any standard for creating CSV's that will work with all the
> major spreadsheets?
>
> I recently tried to create some and didn't find a method that
> would work right with Excel (Office 95 version), Star Office, and
> Quattro Pro (version 8 of WP Offfice, I think).  Doubled quotes,
> e.g.  "6"" Nails", didn't work with Excel, as I recall.  Would
> "6\" Nails"  have worked with all these?
>
>
> Al





More information about the Python-list mailing list