Since you trying to execute the code in the loop 12 times, I suggest you
use the Integer#times method to make your intentions more clear. For
example, this is how you would write the above code snippets with
Integer#times:
Thanks for the reply. But like I said am totally a newbie in ruby. Where
should I exactly include the suggestion that you have given here. And
how should I write it in ruby?
Thanks for your patience. I really need all the help I can get for Ruby.
Thanks.
Bryan D. wrote in post #1049901:
If you read the error message closely, it says that upto does not
exist. What you are actually looking for is Integer#upto. For example:
Since you trying to execute the code in the loop 12 times, I suggest you
use the Integer#times method to make your intentions more clear. For
example, this is how you would write the above code snippets with
Integer#times:
require ‘spreadsheet’
Spreadsheet.open(‘F:\testing.xls’) do |book|
book.worksheet(‘A’).each do |row|
break if row[0].nil?
puts row.join(’,’)
end
end
Its reading everything from my excel file.
What I really need is :
a. I have pass value to the excel file. Lets assume the gvalue to be
“abc” and “xyz”.
b. These two values will be there in the column 1 and 2 of the excel
file “testing.xls”.
c. I need to check that particular row which has the value in column1 as
“abc” and column2 as “xyz” and collect the data from column P and column
Q.
Please somebody modify the code I have written here. To do that.