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.

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

(2010/06/09 20:39), Josh C. 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.

On Tue, Jun 8, 2010 at 9:25 AM, Marvin Gülker [email protected] wrote:

Could someone here help me envision a way to make use of Excel for the
Thank you.
Marvin

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

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

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.

田中 聡 wrote:

(2010/06/09 20:39), Josh C. 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

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.