Fetch an excel sheet name in ruby

Hai friends,
How to fetch an excel sheet name in ruby…

Deepa R. wrote:

Hai friends,
How to fetch an excel sheet name in ruby…

gem install spreadsheet

Regards,

Dan

Dan,
Thanks…
I installed spreadsheet. My concept is.
I download the .xls attachment file from my inbox,but i need to fetch
the excel sheet name through ruby coding.Could you plz help me.

On Tue, Feb 24, 2009 at 8:11 AM, Heesob P. [email protected] wrote:

ws = wb.Worksheets(1)
puts ws.Name
wb.Close
xl.Quit

… and in Spreadsheet:

book = Spreadsheet.open(“/path/to/xls”)
sheet = book.worksheets.first
puts sheet.name

see also:
http://spreadsheet.rubyforge.org
http://spreadsheet.rubyforge.org/files/GUIDE_txt.html
http://spreadsheet.rubyforge.org/classes/Spreadsheet/Worksheet.html

hth

cheers,
Hannes

2009/2/24 Deepa R. [email protected]:

Hai friends,
     How to fetch an excel sheet name in ruby…

You can do it using win32ole like this:

require ‘win32ole’

xl = WIN32OLE.new(‘Excel.Application’)
wb = xl.Workbooks.Open(“c:/work/test.xls”)
ws = wb.Worksheets(1)
puts ws.Name
wb.Close
xl.Quit

Regards,

Park H.