Reading CSV file and storing values into an array

后端 未结 19 1443
猫巷女王i
猫巷女王i 2020-11-22 06:35

I am trying to read a *.csv-file.

The *.csv-file consist of two columns separated by semicolon (\";\").

I am able

19条回答
  •  孤街浪徒
    2020-11-22 07:00

    I have a library that is doing exactly you need.

    Some time ago I had wrote simple and fast enough library for work with CSV files. You can find it by the following link: https://github.com/ukushu/DataExporter

    It works with CSV like with 2 dimensions array. Exactly like you need.

    As example, in case of you need all of values of 3rd row only you need is to write:

    Csv csv = new Csv();
    
    csv.FileOpen("c:\\file1.csv");
    
    var allValuesOf3rdRow = csv.Rows[2];
    

    or to read 2nd cell of

    var value = csv.Rows[2][1];
    

提交回复
热议问题