Help: Need tips for file manipulation

Hello all! I’m just starting with Ruby on Rails and need to ingest a
.csv (Excel) file, and use the data it contains to be shown on screen.
Can anyone show me where to start with this script?

Thanks

On Jun 30, 2006, at 5:49 AM, Dave Linger wrote:

[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Hi-

THere is a CSV class in the ruby stdlib. Pretty easy to use. This

ought to get you up and running:

#in foo.csv
foo,bar,baz,123
nik,kop,dur,3,5
one,two,three,9,8,7
four,five,six,7,3,4

in irb

ez ez $ irb
irb(main):001:0> require ‘csv’
=> true
irb(main):002:0> CSV.open(‘foo.csv’, ‘r’) do |row|
irb(main):003:1* p row
irb(main):004:1> end
[“foo”, “bar”, “baz”, “123”]
[“nik”, “kop”, “dur”, “3”, “5”]
[“one”, “two”, “three”, “9”, “8”, “7”]
[“four”, “five”, “six”, “7”, “3”, “4”]
=> nil
irb(main):005:0>

Cheers-
-Ezra

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs