[ python-Bugs-1532483 ] the csv module writes files that Excel sees as SYLK files

SourceForge.net noreply at sourceforge.net
Tue Aug 1 18:22:58 CEST 2006


Bugs item #1532483, was opened at 2006-08-01 09:52
Message generated for change (Comment added) made by montanaro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1532483&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Vincent Povirk (madewokherd)
>Assigned to: Skip Montanaro (montanaro)
Summary: the csv module writes files that Excel sees as SYLK files

Initial Comment:
I'm using python version 2.4.3

Apparently, when Excel 2003 reads a file, it looks for
the identifying string "ID" at the beginning of the
file. If it finds this string, it assumes it's reading
an SYLK file (see
http://netghost.narod.ru/gff/graphics/summary/micsylk.htm
for some information on SYLK).

The csv module will generate a file that starts with ID
if the first field it writes starts with ID and does
not need to be quoted. When Excel tries to open the
file, the following message pops up:

"Excel has detected that 'test.csv' is a SYLK file, but
cannot load it. Either the file has errors or it is not
a SYLK file format. Click OK to try to open the file in
a different format."

Excel can read the file after clicking OK. Excel
actually has the same problem with CSV files it has
written.

Even so, when using the 'excel' dialect, csv should
write files that Excel can open without any problems.
It could do this by quoting the first field in the file
if it begins with "ID". Unfortunately, csv's Dialect
class does not make this possible. I'm currently
working around it by using QUOTE_NONNUMERIC.

----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2006-08-01 11:22

Message:
Logged In: YES 
user_id=44345

Seems like a shortcoming in Excel 2003 to me, not a problem
with the csv module.  Still, if you can suggest a change
that won't break many other uses of the csv module's output,
I'll consider it.

Have you tried the same test with a later version of Excel?

Skip


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1532483&group_id=5470


More information about the Python-bugs-list mailing list