From: James Edward Gray II Date: 2005-11-21T22:46:22+09:00 Subject: Re: Parsing excel CVS data on a mac OSX to extract blocks of cells On Nov 21, 2005, at 6:47 AM, anne001 wrote: > Thank you so much for your help > The data was collected by another lab. I don't know what they use. I > saved their excel file data into a csv file. I don't know if there > is a > way of telling excel to do a better job. I am on panther, with > office 2004 for mac. Excel might be legacy enough that it's still using \r as a return here, for the old Mac OS. Try this: ruby -p -i.bak -e 'sub("\r", "\n")' your_csv_file_here.csv > require "csv" > arr = CSV.read(File.expand_path("~/Desktop/FaceRetest.cvs")) > > I get an error: > /usr/local/lib/ruby/1.8/csv.rb:607:in `get_row': > CSV::IllegalFormatError (CSV::IllegalFormatError) > > Ara's formulation does the same thing. I think this is a line ending issue. The CSV format does not allow a naked \r outside of a quoted field. Try my fix above and see if it gets you going, or you can switch the line ending for CSV's readlines(): require "csv" arr = CSV.readlines(File.expand_path("~/Desktop/FaceRetest.cvs"), "\r") If you're still having trouble and it's not a privacy concern, you are welcome to email me the CSV file off list, and I will try to figure out how to read it. James Edward Gray II