Forum: Ruby Excel spreadsheet

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.
Fd870ca69f1243766bd8697ea3415df2?d=identicon&s=25 Paatsch, Bernd (Guest)
on 2006-02-07 02:37
(Received via mailing list)
Hello,

Is it possible to access Excel spreadsheets through ruby?
If so is there somewhere a code example I can have a look at?

Thanks,
Bernd
508861510639b56d61eb30e6a28b01d9?d=identicon&s=25 John Maclean (Guest)
on 2006-02-07 03:05
(Received via mailing list)
I've seen something in the source code...
/usr/share/doc/ruby-docs-1.8.4/ext/win32ole/sample/

require 'win32ole'

#application = WIN32OLE.new('Excel.Application.5')
application = WIN32OLE.new('Excel.Application')

application.visible = TRUE
workbook = application.Workbooks.Add();
worksheet = workbook.Worksheets(1);
worksheet.Range("A1:D1").value = ["North","South","East","West"];
worksheet.Range("A2:B2").value = [5.2, 10];
worksheet.Range("C2").value = 8;
worksheet.Range("D2").value = 20;

range = worksheet.Range("A1:D2");
range.Select
chart = workbook.Charts.Add;

workbook.saved = TRUE;

application.ActiveWorkbook.Close(0);
application.Quit();

On Tue, 7 Feb 2006 10:36:00
430ea1cba106cc65b7687d66e9df4f06?d=identicon&s=25 David Vallner (Guest)
on 2006-02-07 03:17
(Received via mailing list)
DÅ?a Utorok 07 Február 2006 02:36 Paatsch, Bernd napísal:
> Hello,
>
> Is it possible to access Excel spreadsheets through ruby?
> If so is there somewhere a code example I can have a look at?
>
> Thanks,
> Bernd

If the machine in question is a Windows box with Excel already
installed, your
best bet is probably using Win32OLE and accessing an Excel interface via
COM.
Best look at Win32OLE, and Windows / Excel automation docs.

http://www.rubygarden.org/ruby?ScriptingExcel looks like good
introductory
sample code too.

If not, I can only recall a writer package that worked with the binary
format,
and I had mixed success getting it run on and off Cygwin. There might be
something out there that will let you read the zipped XML format out
there,
but I can't recall anything off the top of my head, nor see something
that
flicks a lightbulb on in the first screen of googlage results.

You might feel particularly adventurous and try compiling the POI ruby
bindings, if the thought of working with with GCC compiled Java doesn't
scare
you. (It does indeed scare me...)

That said, the topic is also fairly recurrent on the list in my opinion,
so
give searching the ML archives a try too.

David Vallner
9dfe8c734b0f9b37a4e218425c0a2138?d=identicon&s=25 Gene Tani (Guest)
on 2006-02-07 05:40
(Received via mailing list)
Paatsch, Bernd wrote:
> Hello,
>
> Is it possible to access Excel spreadsheets through ruby?
> If so is there somewhere a code example I can have a look at?
>
> Thanks,
> Bernd

I once counted 5 ways to get at Excel data: CSV, OLE, XML, ADO and i
can't remember what the other one was.
74361169979a843b3a5c12d81000debc?d=identicon&s=25 Jon Egil Strand (Guest)
on 2006-02-07 09:02
(Received via mailing list)
There are lots you can do, some pointers have already been posted.
Please
feel free to specify your needs more clearly and we can adress them
together.

All the best
Jon Egil Strand

 --
Jon Egil Strand
Phone: +47 98232340
jes@luretanker.no
149379873fe2cb70e550c6bff8fedd0c?d=identicon&s=25 Jeffrey Schwab (Guest)
on 2006-02-07 15:06
(Received via mailing list)
Paatsch, Bernd wrote:

> Is it possible to access Excel spreadsheets through ruby?
> If so is there somewhere a code example I can have a look at?

In case you missed this:

http://groups.google.com/group/comp.lang.ruby/brow...
This topic is locked and can not be replied to.