Forum: Ruby Fetch an excel sheet name in ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Deepa R. (Guest)
on 2009-02-24 06:58
Hai friends,
          How to fetch an excel sheet name in ruby...
Daniel B. (Guest)
on 2009-02-24 07:06
(Received via mailing list)
Deepa R. wrote:
> Hai friends,
>           How to fetch an excel sheet name in ruby...

gem install spreadsheet

Regards,

Dan
Deepa R. (Guest)
on 2009-02-24 08:05
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.
Heesob P. (Guest)
on 2009-02-24 09:13
(Received via mailing list)
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.
Hannes W. (Guest)
on 2009-02-24 10:17
(Received via mailing list)
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/Spreadshe...

hth

cheers,
Hannes
This topic is locked and can not be replied to.