Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am writing a routine for reading in data from a CSV I have it opening the file, trimming off the unwanted headers and getting to the data, I can get an entry out and parse it with a foreach() to get the data individually however there seems to be an off set of one which can result in the data being in the wrong place from record to record. If I view the CSV in Excel there is not a visible difference. Can there be some characters inserted by Excel (control characters) that are left when it saves it out as a CSV ?
Posted

1 solution

Glenn, why are you reinventing the wheel?
C# CSV Reader and Writer[^]
A Fast CSV Reader[^]
Will do the job for you, and a lot less hassle than "brewing your own".
 
Share this answer
 
Comments
glennPattonWork3 12-May-14 11:11am    
I did find A Fast CSV Reader while digging around, I was more interested in if Excel can put bits of data in when it saves it, as my prog has all the data in a list box just some extra ','s where there should be...
OriginalGriff 12-May-14 11:24am    
What's your data look like? Can you DropBox it?
glennPattonWork3 12-May-14 11:27am    
Sure here it is:
https://dl.dropboxusercontent.com/u/66257998/T4%20_%20MasterList_IniLoader%20-%20Copy.csv
OriginalGriff 12-May-14 11:38am    
The first thing I notice is that it contains embedded double-quotes, followed by commas - so if your software isn't handling embedded D-Q properly, it's going to look like "off by one" errors on some lines.
What does the problem look like in the list box?
glennPattonWork3 12-May-14 11:45am    
Ahh Okay, the old copy it to clipboard trick isn't working give me a min.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900