How to convert xls to csv?

How to access row value using spreadsheet? How to find last row or end of file using roo? How to convert xls to csv?

google "ruby excel"

Hi Salil,

To convert xls to csv and then parse for use in ruby, you could try wrapping xls2csv (catdoc and xls2csv - free MS-Office format readers) and parsing via CSV (Index of Classes & Methods in csv: Ruby Standard Library Documentation (Ruby 3.1.2) index.html), something like:

$ irb irb(main):001:0> require 'csv' => true

irb(main):002:0> csv_raw = `xls2csv test.xls`.sub(/\s+$/, "\n") => "\"fruit\",\"color\"\n\"banana\",\"yellow\"\n\"strawberry\",\"red \"\n\"tangerine\",\"orange\"\n"

irb(main):003:0> CSV.parse(csv_raw) {|rec| puts rec.inspect } ["fruit", "color"] ["banana", "yellow"] ["strawberry", "red"] ["tangerine", "orange"] => nil