I could be the last person to find out about the ‘SYLK’ issue with loading CSVs in Excel, but the good thing about that is there are plenty of answers out there as to why it happens.

My current project has a “download database data to CSV” feature, and every database table starts with “ID” as the first column.  Generating CSV files with headers would give something like this:

"ID", ....
1, ....
2, ....

A quick search on Google gave me this page, with a very blunt answer as to why it happens:

Because the Excel programmers are sloppy. A valid SYLK file begins
with ‘ID;’ or ‘ID’ alone on a line.

Sometimes Excel incorrectly says ‘SYLK: file format is not valid.’.

When you try to open a text file that begins with, say, ‘ID’ and a tab,
it could not possibly be a valid SYLK file, but Excel claims it thought
it was, to no avail.

Simply rename ‘ID’ to ‘Ident’ or ‘Id’ or something similar.

Changing “ID” to “Id” fixed the problem, and my CSV files opened in Excel correctly.  Now hopefully no one else gets tricked by this Easter Egg Microsoft left for us.

2 Responses to “Excel 2003+: Invalid ‘SYLK’ file error when loading CSV”

I am using Excel 2007 and it has the same problem. Four years later and they still have not fixed it. They are either too lazy, or too stupid or too indifferent the the needs of the customer.

I am about to try Open Office to see if the learning curve is simular. Then I can kiss this crap bye bye.

Oh yea, I hate Microsoft!

Comment by Jedikiah — January 28, 2009 @ 7:59 pm

There is a good tool which works with excel files-Excel infected files,as far as i know application is free,it protect your data against possible damage due to a variety of reasons, from virus or hacker attack to hardware damage,will help to recover all data and repair Excel infected files, that are considered lost and save many days of your precious time for retyping all documents,export the results into a new document in Microsoft Excel format,repair your MS Excel damage file, when you need to repair Excel file.

Comment by del_piero — April 8, 2009 @ 12:11 am

leave a reply?