From: James Gray Date: 2009-03-02T01:20:25+09:00 Subject: Re: How to find the specific row of CSV file. On Mar 1, 2009, at 7:06 AM, Salil Gaikwad wrote: > it works 4 me but is it right to use for a csv file which has more > than > 5000 rows? It would probably be better to iterate over the rows and deal with them one at a time if possible. > also I use following method to read CSV file. > > > @parsed_file=FasterCSV.read("#{RAILS_ROOT}/.....",:col_sep=>",", > :quote_char=>",", :force_quotes=>true) > @parsed_file.each_with_index do |row, index| > // more code here > > end As Craig said, you don't want the same quote character as your column separator. That makes the data impossible to parse correctly. > My problem is that when there is a special characters in csv row-field > it gives me either an error or wrong value for ex. "\".63\"" for .63 I'm almost certain this is caused by your bad quote character setting. > what should i do so that it accept and hence read all the characters & > special characters so that i save it into the database(mysql) > correctly. If you are in control of the output and input, just let FasterCSV spit out the data with normal CSV rules and escaping. It will then read it back in just as it was. James Edward Gray II