Bootstrap FreeKB - Microsoft Excel - Resolve error "Excel has detected that 'example.csv' is a SYLK file, but cannot load it"
Microsoft Excel - Resolve error "Excel has detected that 'example.csv' is a SYLK file, but cannot load it"

Updated:   |  Microsoft Excel articles

The following errors may appear when using the PHP fputcsv command:

  • The file format and extension of 'example.csv' don't match. The file could be corrupted to unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?
  • Excel has detected that 'example.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.

These errors may appear because the first column in the array is ID. Some Microsoft produces, including Excel, have some issues when cell A1 is ID.

fputcsv($fp, array('ID', 'Column2', 'Column3'));

 

The easy fix for this is to A1 from upper case ID to lower case id.

fputcsv($fp, array('id', 'Column2', 'Column3'));



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 179d6e in the box below so that we can be sure you are a human.