Skip to content

Importing CSV file

Ken mcGrath

Asked Nov 28, 2005, 8:22 AM EST4 answers
Share
LinkedInX
Hi

I want to import a csv file into c# and then manipulate it and output a textfile.

I'm looking for help on how to go about this.

I have the oledb connection set up, however I dont want to put it into a datagrid because I have no use for the grid.

Would a hashtable be the best option? And if so what the correct way to approach the problem.

Thanks

4 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mike Gold
    0
    As far as I know, a CSV file is a text file, simply a comma delimited file.  You can read it in using StreamReader, manipulate it as a string, and output it as a different file using StreamWriter.  Is this what you meant?

    -Mike G.
    0
  • 0

    I wasn't aware of that. I though you would need to access it as a excel file.

    Will give it a shot!

    Thanks very much

    0
  • 0
    I've got the file importing, however I wish to select distinct rows and columns and export them to a textfile.

    Basically select all distinct usernames and certain other cells relating to the distinct username.

    What do you suggest as the best method. Hashtable?

    Thanks
    0
  • 0
    What exactly u wanted to do....
    can u explain more clearly
    0