A small CSV file that was generated on a Windows server is not opening correctly on Linux/Mac.
The only way to open this file is via MS Excel for Mac, which gives the following prompt:
The CSV file has the proper extension .csv
and "get info" in Finder shows that it is in-fact a CSV file. Weird thing is that it is called "Comma Separated Spreadsheet" rather than "Comma Separated Values":
When opening the file with TextEdit, the result is an empty file:
When using the file
command in Terminal, the output is not "CSV" as it should be. It says it is "Zip archive data"
:
Is this a common error with CSVs between OS's? Unable to find any resources online. Appreciate the help.
cat
orxxd
on the file in the terminal to see the raw file contents, rather than relying on TextEdit, which appears to be reading it as an RTF file. If it is an intact CSV file, you should see human-readable file contents. If the file is very large, use a command likecat file.csv | head -n5
to just see the first few lines.cat
on file does not display human-readable file contents. Suspect there is an error with how it is being saved on Windows server side. Thanks. Any other thoughts?.xlsx
to.csv
? If the file extension was changed, this explains whyfile
reports that it is a ZIP file, since XLSX files are simply zipped directories containing XML files. Try changing the file extension to.xlsx
and see what happens.