From: Jiawei Yong Date: 2011-01-25T16:32:50+09:00 Subject: Re: Obtain data from .csv Steel Steel wrote in post #977326: > does you CSV file actually really have those square brackets?? If yes, > you can strip them off first > > f = File.open("ActionPlan.csv", "r") > f.each_line { |line| > line = line.gsub!(/^\[\"|\"\]$/,"") > fields = line.split(',') > > } > > i am not sure why you are stripping of double quotes from each field, > when the sample csv you supplied doesn't tally with what you are doing. Actually I have this feeling the posted segment ["Issue,,Risk/Opportunity,Compliance,Consequence,Current Status,Due Date,Priority,Responsibility,Probability"] ["1,Efficiency (Energy),No Action,Unknown,Neutral,Active,,Medium,,Possible"] ["Action,,Cost,Status,Due Date,Responsibility,,,,"] ["1.a,Maximise use of natural lighting,,Active,,,,,,"] ["1.b,Turn-off unnecessary lights/equipment,,Active,,,,,,"] ["1.c,Install energy efficient lighting,,Active,,,,,,"] ["1.d,Turn-off unnecessary air conditioning,,Active,,,,,,"] is the result of some File operations in irb... -- Posted via http://www.ruby-forum.com/.