The file is created in javascript and downloaded through an a tag. But Excel complains that there is something wrong with the file format.
Apparently Excel wants the BOM at the beginning, but I have no idea how to change that. The file is encoded in Base64.
First error: The file format and extension of 'filename.csv' don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you wan to open it anyway?
Second error after Yes: Excel has detected that 'filename.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.
Does your output file start with 'ID' ? If so then open the csv in a text editor and change it. see http://support.microsoft.com/en-us/kb/215591 for more info
EDIT:
That link is now dead - however using the wayback machine it said:
MORE INFORMATION A SYLK file is a text file that begins with "ID" or "ID_xxxx", where xxxx is a text string. The first record of a SYLK file is the ID_Number record. When Excel identifies this text at the beginning of a text file, it interprets the file as being a SYLK file. Excel attempts to convert the file from the SYLK format, but is unable to because there are no valid SYLK codes following the "ID" characters. Because it cannot convert the file, Excel generates the error.
This is another link which explains it - not sure how long this link will last either so here's a screen capture for future reference also: