Fetch an excel sheet name in ruby

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

···

--
Posted via http://www.ruby-forum.com/.

Deepa Rajendran wrote:

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

gem install spreadsheet

Regards,

Dan

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 Heesob

···

2009/2/24 Deepa Rajendran <deeparaj12@gmail.com>:

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

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.

···

--
Posted via http://www.ruby-forum.com/.

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

···

On Tue, Feb 24, 2009 at 8:11 AM, Heesob Park <phasis@gmail.com> wrote:

2009/2/24 Deepa Rajendran <deeparaj12@gmail.com>:

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