Can't able to read all the Rows in CSV file:

Hi All,

I am new to ruby and i am trying to read the data from CSV file. The CSv
file has 240 rows and a single Column in it. I wanted to read the row by
row data and process that and then fetch the next row. Can some one
please let me know how i can implement it. Please refer me some
documents so that i can improve my Ruby Knowledge. Thanks all.

Good morning Sai,

there are many libraries for reading CSV in ruby. There’s even a class
in the standard library:

Take a look at the first example, (Reading → From a File → A Line at a
Time) you should be able to insert your own file name and then do
something with each row of the csv file. A good first thing to do is
simply put it onto the terminal, so that you know everything is working!

If the CSV file consists of a single column only, can’t you just process
it line by line like any other text file?

Joe Gain wrote in post #1183864:

Good morning Sai,

there are many libraries for reading CSV in ruby. There’s even a class
in the standard library:

Class: CSV (Ruby 2.3.0)

Take a look at the first example, (Reading → From a File → A Line at a
Time) you should be able to insert your own file name and then do
something with each row of the csv file. A good first thing to do is
simply put it onto the terminal, so that you know everything is working!

Hi Joe,

I could able to read the row contents one after the other and is working
fine. Thanks for the reply.

Ronald F. wrote in post #1183877:

If the CSV file consists of a single column only, can’t you just process
it line by line like any other text file?

Hi Ronald,

I could able to read the CSV file one after the other and could able to
process them. Thanks for the response.