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.
D2f4861bb915581c2aca4fc9f2c8015d?d=identicon&s=25 Deepa Rajendran (deeparaj)
on 2009-02-24 05:58
Hai friends,
          How to fetch an excel sheet name in ruby...
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (djberg96)
on 2009-02-24 06:06
(Received via mailing list)
Deepa Rajendran wrote:
> Hai friends,
>           How to fetch an excel sheet name in ruby...

gem install spreadsheet

Regards,

Dan
D2f4861bb915581c2aca4fc9f2c8015d?d=identicon&s=25 Deepa Rajendran (deeparaj)
on 2009-02-24 07: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.
666b4e17b4bb0e2d999037a25f65a7cb?d=identicon&s=25 Heesob Park (phasis)
on 2009-02-24 08:13
(Received via mailing list)
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


Regards,

Park Heesob
9d0207c91dd4cbc7e7b5f5be98c85e2b?d=identicon&s=25 Hannes Wyss (spreadsheet)
on 2009-02-24 09:17
(Received via mailing list)
On Tue, Feb 24, 2009 at 8:11 AM, Heesob Park <phasis@gmail.com> 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.