How can I use Ruby with MS Excel?

  • Thread starter Jason Lillywhite
  • Start date
J

Jason Lillywhite

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

Marvin Gülker

Jason said:
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
http://rubyonwindows.blogspot.com/search/label/excel which has several
blog posts about using Ruby together with excel. This post may makes a
good starting point:
http://rubyonwindows.blogspot.com/2008/01/rubygarden-archives-scripting-excel.html

Marvin
 
J

Jason Lillywhite

N

Nation, Carey

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: (e-mail address removed) [mailto:[email protected]]
Sent: Wednesday, June 09, 2010 8:52 AM
To: ruby-talk ML
Subject: Re: How can I use Ruby with MS Excel?

$BEDCf(J $BAo(J said:
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$B!G(Js new file format .xlsx
 
M

Mark Thomas

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top