From: Deepa Rajendran Date: 2009-02-25T17:01:01+09:00 Subject: Re: Fetch an excel sheet name in ruby Hi, Thanks those who help me Here is the coding.which i got the excel sheet name.but i have a doubt how to use minimum and maximum value to generate random number in ruby. require 'win32ole' require 'rubygems' excel = WIN32OLE.new("excel.application") excel.visible =false workbook = excel.workbooks.open("E:\\Book1.xls") tt=workbook.Worksheets.count puts "Number of Worksheets" puts tt.to_i puts "Randomly Generate" ff=rand(tt) if ff.to_i==0 ff=1 else ff=ff end puts ff.to_i worksheet=workbook.worksheets(ff) puts "Worksheet Name" puts worksheet.Name workbook.Close excel.Quit -- Posted via http://www.ruby-forum.com/.