2007/9/18, Ronald Fischer <ronald.fischer / venyon.com>:
> > I have a .csz file created from a spreadsheet which contains
> > 666 rows and 19 columns. What I would like to do is read the
> > csz file into an array in ruby and store that array as a set
> > of columns and rows (like in excel).
>
> [snip]
>
> > My question is basically how do I do what I want to do?... It
> > is difficult for a new starter but I suspect you guys would
> > know it inside out!
>
> Since you want to mimic the spreadsheet idiom (a table of rows
> and columns), I suggest you create an "array of arrays".
> Something like (code not tested!):
>
> table=[] # create new array
> open("your filename goes here").each do |line|
>   fields=[] # array of fields in each line
>   line.each(',') { |field|
>     fields << field.chomp(',').strip
>   }
>   table << fields
> end

Plus the reading / parsing could be done by a CSV library.

Kind regards

robert