Fetch an excel sheet name in ruby


#1

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


#2

Deepa R. wrote:

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

gem install spreadsheet

Regards,

Dan


#3

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.


#4

On Tue, Feb 24, 2009 at 8:11 AM, Heesob P. removed_email_address@domain.invalid 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


#5

2009/2/24 Deepa R. removed_email_address@domain.invalid:

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.