I’ve just spent the morning battling with a piece of code that that pulls about 7000 rows from join over 5 tables, does a bit of post processing and then exports it as a .csv file with about 15 columns.
I hunted down all the bugs until everything worked fine, the script would run and the windows alert box would pop up asking if I wanted to save or open the file, so far so good.
But then try and open the file in Excel and bang:
SYLK: File format is not valid
What the hell does this mean? I spent hours tweaking and adjusting, looking at the file in editplus and OpenOffice – looking for some kind of error to do with un-escaped characters… nothing, not a peep.
As a final last ditch attempt, before I pulled all my hair out, I typed the Excel error message into Google… guess what:
http://support.microsoft.com/kb/323626
“SYLK: File format is not valid” error message when you open file
SYMPTOMS
When you try to open a text file or a comma-separated variable (CSV) file, you may receive the following error message:
SYLK: File format is not valid
Back to the top
CAUSE
This problem occurs when you open a text file or CSV file and the first two characters of the file are the uppercase letters “I” and “D”. For example, the text file may contain the following text:
ID, STATUS
123, open
456, closed
Note This problem does not occur if the first two letters are lowercase “i” and “d”.
How daft is that.