How can I use Ruby with MS Excel?

As much as I hate to say it, Microsoft Excel is here to stay and will
continue to be the most popular tool among engineers and scientists.
When I say engineers, I mean mechanical, civil, environmental, chemical
engineers. The new version of Excel has some very nice graphical
capability.

I love Ruby and hate Visual Basic with passion. Hopefully that goes
without further explanation.

Could someone here help me envision a way to make use of Excel for the
input/output and Ruby for the model logic?

In the perfect world, I would set up spreadsheet columns in Excel with
input data. Maybe I would have a couple of GUI windows for other inputs.
Then I could run the logic written in Ruby and output would be fed back
to spreadsheet columns in Excel. Then I could make use of their nice
graphing capabilities.

Has anyone looked into this question?

Thank you.

···

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

Jason Lillywhite wrote:

As much as I hate to say it, Microsoft Excel is here to stay and will
continue to be the most popular tool among engineers and scientists.
When I say engineers, I mean mechanical, civil, environmental, chemical
engineers. The new version of Excel has some very nice graphical
capability.

I love Ruby and hate Visual Basic with passion. Hopefully that goes
without further explanation.

Could someone here help me envision a way to make use of Excel for the
input/output and Ruby for the model logic?

In the perfect world, I would set up spreadsheet columns in Excel with
input data. Maybe I would have a couple of GUI windows for other inputs.
Then I could run the logic written in Ruby and output would be fed back
to spreadsheet columns in Excel. Then I could make use of their nice
graphing capabilities.

Has anyone looked into this question?

Thank you.

Since it looks like on every computer excel is set up, you can connect
to an excel OLE server and issue all the commands you can from
VisualBasic (as far as I know). Have a look at
Ruby on Windows: excel which has several
blog posts about using Ruby together with excel. This post may makes a
good starting point:
Ruby on Windows: RubyGarden Archives: Scripting Excel

Marvin

···

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

Any resources about how to access those formats on a Unix/Linux machine?

···

On Tue, Jun 8, 2010 at 9:25 AM, Marvin Gülker <sutniuq@gmx.net> wrote:

Jason Lillywhite wrote:
> As much as I hate to say it, Microsoft Excel is here to stay and will
> continue to be the most popular tool among engineers and scientists.
> When I say engineers, I mean mechanical, civil, environmental, chemical
> engineers. The new version of Excel has some very nice graphical
> capability.
>
> I love Ruby and hate Visual Basic with passion. Hopefully that goes
> without further explanation.
>
> Could someone here help me envision a way to make use of Excel for the
> input/output and Ruby for the model logic?
>
> In the perfect world, I would set up spreadsheet columns in Excel with
> input data. Maybe I would have a couple of GUI windows for other inputs.
> Then I could run the logic written in Ruby and output would be fed back
> to spreadsheet columns in Excel. Then I could make use of their nice
> graphing capabilities.
>
> Has anyone looked into this question?
>
> Thank you.

Since it looks like on every computer excel is set up, you can connect
to an excel OLE server and issue all the commands you can from
VisualBasic (as far as I know). Have a look at
Ruby on Windows: excel which has several
blog posts about using Ruby together with excel. This post may makes a
good starting point:

Ruby on Windows: RubyGarden Archives: Scripting Excel

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

(2010/06/09 20:39), Josh Cheek wrote:

Any resources about how to access those formats on a Unix/Linux machine?

I found spreadsheet gem for read/write Excel files.
According to project page, this library works on any platform.

http://spreadsheet.rubyforge.org/
http://rubyforge.org/projects/spreadsheet/

sorry, I have not use it yet. FYI.

···

--
modka

田中 聡 wrote:

(2010/06/09 20:39), Josh Cheek wrote:

Any resources about how to access those formats on a Unix/Linux machine?

I found spreadsheet gem for read/write Excel files.
According to project page, this library works on any platform.

http://spreadsheet.rubyforge.org/
http://rubyforge.org/projects/spreadsheet/

sorry, I have not use it yet. FYI.

Just found this:
http://roo.rubyforge.org/

This gem allows you to access the content of

    * Open-office spreadsheets (.ods)
    * Excel spreadsheets (.xls)
    * Google (online) spreadsheets
    * Excel’s new file format .xlsx

···

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

Any resources about how to access those formats on a Unix/Linux machine?

I have had success with JRuby and the Apache POI library (http://
poi.apache.org), which is fairly feature-ful.

···

--
Mark

There is one caveat which may no longer be a problem. It's been a while since I've tried to do this. It used to be that there was no way with the ruby com libraries to access any com interface that an object exposed other than the default one. Some of the objects expose multiple interfaces that provide different sets of functionality, just as you would expect an interface to do. If you can't get a pointer to that interface, you just can't do those things on that object.

···

-----Original Message-----
From: jason.lillywhite@gmail.com [mailto:jason.lillywhite@gmail.com]
Sent: Wednesday, June 09, 2010 8:52 AM
To: ruby-talk ML
Subject: Re: How can I use Ruby with MS Excel?

田中 聡 wrote:

(2010/06/09 20:39), Josh Cheek wrote:

Any resources about how to access those formats on a Unix/Linux machine?

I found spreadsheet gem for read/write Excel files.
According to project page, this library works on any platform.

http://spreadsheet.rubyforge.org/
http://rubyforge.org/projects/spreadsheet/

sorry, I have not use it yet. FYI.

Just found this:
http://roo.rubyforge.org/

This gem allows you to access the content of

    * Open-office spreadsheets (.ods)
    * Excel spreadsheets (.xls)
    * Google (online) spreadsheets
    * Excel’s new file format .xlsx
--
Posted via http://www.ruby-forum.com/\.