Modifying an Excel file with Ruby

Hi all,
I have an Excel XLS file that is full of pre-existing charts, formulas,
worksheets, etc.
I need to be able to open it up, fill in a hidden worksheet with some
values from a database, and save it out again without losing all the
charts/formulas/worksheets/etc. So
http://rubyforge.org/projects/spreadsheet/ is out of the question.
And i can’t use win32::ole because i won’t be hosting on a windows
server.

Does anyone have any ideas? I’m even considering shelling out to a perl
or python script, but i thought i’d look here first.

Thanks in advance,
Chris

Hi,

I never tried this binding on POI Java library, but it could be useful
to you :

http://poi.apache.org/poi-ruby.html

Come

Dear Chris,

just a little googling came up with this:

http://rails.co.za/articles/2006/12/16/excel-ole-automation-with-ruby-in-linux

HTH,

Axel

just a little googling came up with this:
http://rails.co.za/articles/2006/12/16/excel-ole-automation-with-ruby-in-linux
HTH,
Axel

Hi,
Thanks, but i can’t use OLE because this won’t be hosted on windows.

I never tried this binding on POI Java library, but it could be useful
to you :
POI Ruby Bindings
Come

Fair enough, i assumed i’d have to use a java or perl or python library.
Its a pity, because an all-ruby solution keeps the cost of hosting down
:slight_smile:

Any all-ruby solutions? I guess i could go to the effort of porting
the python pyExcelarator library to ruby, it’s the closest to what i’m
after, but if there’s an solution already out there, i’d like to hear
about it.

Cheers

Axel E. wrote:

the claim in the link I sent you was that they
do use Linux, rather than Windows, and still
got (some workaround access to) OLE to work …
But I haven’t tried this myself, so I wrote
“just a little googling” … but I’d be interested
if you could post what solution you eventually go for.

Best regards,

Axel

Cheers buddy, I must have switched off the moment i saw ‘ole’ in the
URL.
I had a read, and it appears he got it to work using WINE. Clever trick,
and i guess you could do that if you owned the server yourself (or you
had a really good virtual hosting package) but for my situation (using
a typical rails host) it probably isn’t going to help.
Still, thanks for the pointer.

Dear Chris,

Hi,
Thanks, but i can’t use OLE because this won’t be hosted on windows.

the claim in the link I sent you was that they
do use Linux, rather than Windows, and still
got (some workaround access to) OLE to work …
But I haven’t tried this myself, so I wrote
“just a little googling” … but I’d be interested
if you could post what solution you eventually go for.

Best regards,

Axel

-------- Original-Nachricht --------
Datum: Wed, 20 Jun 2007 20:40:25 +0900
Von: Chris H. [email protected]
An: [email protected]
Betreff: Re: Modifying an Excel file with Ruby

Chris H. wrote:

Axel E. wrote:

the claim in the link I sent you was that they
do use Linux, rather than Windows, and still
got (some workaround access to) OLE to work …
But I haven’t tried this myself, so I wrote
“just a little googling” … but I’d be interested
if you could post what solution you eventually go for.

Hi Chris,
I am facing same issue for my application, could you share with us if
you find some better solution.

I too am interested in this question. I’ll definitely post what I find
out and hope to hear from others.

Christopher S. wrote:

I too am interested in this question. I’ll definitely post what I find
out and hope to hear from others.

This is your best bet:
http://poi.apache.org/poi-ruby.html

I’ve tried the .net version of POI, it’s great - far better than any
other open source excel libraries. I can only assume the java and ruby
versions are good too.