Yesterday after exporting some data from one of my WordPress site to CSV I got a rude shock after trying to open the file with Excel.
According to it, apparently the file was not a CSV but a SYLK File. The specific error was as follows:
Excel has detected ‘file.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.Warning thrown by Excel
Reason: if the first cell on a CSV starts with ID, Excel just assumes you are trying to open a SYLK File.
Fixing the Error without Rendering the CSV Unusable
From that post, it’s self-explanatory that in order to fix the error, we only need to change the ID text with a different text. The problem with that however is if that we may run into issues when we try to use that CSV elsewhere where the first cell has to start with ID.
That precisely was my situation, as I needed to import the CSV back into WordPress after I was done editing it. Fortunately, I did find a workaround after contemplating using a different CSV editor.
So it’s pretty simple, do the following:
- Open the CSV with a plain text editor like Notepad and change ID into some text that doesn’t start with ID e.g temp
- Save the CSV then open it with Excel. This time it won’t throw you the SYLK file error. Do your editing and save the CSV.
- Open the CSV with the plain text editor again and change the edited text back to ID. Save the file and that’s it!