Fetch an excel sheet name in ruby

D

Deepa Rajendran

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.
 
H

Heesob Park

2009/2/24 Deepa Rajendran said:
Hai friends,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0How to fetch an excel sheet name in rub=
y...

You can do it using win32ole like this:

require 'win32ole'

xl =3D WIN32OLE.new('Excel.Application')
wb =3D xl.Workbooks.Open("c:/work/test.xls")
ws =3D wb.Worksheets(1)
puts ws.Name
wb.Close
xl.Quit


Regards,

Park Heesob
 
H

Hannes Wyss

You can do it using win32ole like this:

require 'win32ole'

xl =3D WIN32OLE.new('Excel.Application')
wb =3D xl.Workbooks.Open("c:/work/test.xls")
ws =3D wb.Worksheets(1)
puts ws.Name
wb.Close
xl.Quit


... and in Spreadsheet:

book =3D Spreadsheet.open("/path/to/xls")
sheet =3D 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top