On Fri, Jan 24, 2014 at 1:29 PM, Raju Ruby <lists / ruby-forum.com> wrote:
> hi Jesus,
>    Thank you for replying promptly for my query.This is my code,
>
> require 'watir-webdriver'
> require 'rspec/expectations'
> require 'spreadsheet'
> Spreadsheet.client_encoding = 'UTF-8'
> book = Spreadsheet::Workbook.new
> book = Spreadsheet.open 'path to my excel'
>
>
> @browser = Watir::Browser.new :firefox
> @browser.goto "testurl"
>
> def textbox(obj_name, obj_value)
>   @browser.text_field(:id => obj_name).set(obj_value)
> end
>
> sheet = book.worksheet(0)
>
> sheet.each do |row|
>   send row[0],row[1],row[2]
> end
>
>
> This is what i am using. My excel spreadsheet has three column for the
> above example. But i will be calling many functions from the same excel
> each having varying number of parameters. How will i implement this.

Looking a little bit at the spreadsheet gem, it seems that the Row
class inherits from Array, so you should be able to do this:

sheet.each do |row|
  send *row
end

but I haven't tested it.

Jesus.