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.

Leave a Reply