Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSV first cell restrictions

Tags:

c#

csv

excel

If I create csv file (I'm doing it from C#), which contains text "ID" in first cell in first row, MS Excel 2010 fails to open it, it says, file is not a valid csv file. I spend a half of an hour, before I realized that problem is with that "ID". Most interesting thing in this situation is, that if "ID" is moved to any other cell, everything works just fine.

Steps to reproduce : Create text file with following content:

ID,Name
1,Unnamed

Save it.Change extension to csv.

That's all, MS Excel 2010 will tell you that this file is not a csv and will fail to open it!

What I am doing wrong?I googled for some info, but it seems, ID is not some kind of reserved word.

I'm running Win7Enterprisex64 and using MS Excel 2010, as I mentioned. P.S depending on your culture settings, csv separator may be , or ; (maybe some other characters)

like image 525
illegal-immigrant Avatar asked Aug 31 '11 16:08

illegal-immigrant


1 Answers

The problem is that Excel thinks the file is a "SYLK" file. It is a known issue.

like image 75
Pedro Avatar answered Sep 27 '22 21:09

Pedro