i want to read data from a csv file and save it into the database.
my file xyz.csv contains following line
,“xyz”,
i want o/p of above row
as follows
nil,nil,nil,nil,"“xyz”", nil,nil,nil,nil
currently i get
nil,nil,nil,nil,"“xyz”",""
i am using following method to read the data
@parsed_file=FasterCSV.read(“xyz.csv”, :col_sep =>",",
:quote_char=>’,’, :force_quotes => true)
i want to read data from a csv file and save it into the database.
my file xyz.csv contains following line
,“xyz”,
i want o/p of above row
as follows
nil,nil,nil,nil,“"xyz"”, nil,nil,nil,nil
i am using following method to read the data
@parsed_file=FasterCSV.read(“xyz.csv”, :col_sep =>“,”,
:quote_char=>‘,’, :force_quotes => true)
Again, do not set :quote_char and :col_sep to the same value. That’s
impossible to parse. Also :force_quotes is only used when writing
CSV, not reading it.
James Edward G. II
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.