I'm writing a small Ruby pgm to demonstrate that FasterCVS is a good
way to handle CSV data.
I put up a small CSV file and demonstrated the FasterCSV aspect. I'd
like to precede that step by automatically bringing up the CSV file in
Excel. (I know I could bring it up manually, but I'd like a self-
contained demo for a computer-illiterate person.)
I've got "fn" set to a string which is the fully qualified name of the
CSV file. I concocted the (failing) command:
SystemCommand.start("Excel", fn)
based on my interpretation of the RDoc for Shell::SystemCommand. I
took a wild stabs to no avail at adding "require 'system'" and
"require 'shel'"
Datum: Sun, 26 Oct 2008 02:24:53 +0900
Von: RichardOnRails <RichardDummyMailbox58407@uscomputergurus.com>
An: ruby-talk@ruby-lang.org
Betreff: Open a MS Excel file from within Ruby
Hi.
I'm writing a small Ruby pgm to demonstrate that FasterCVS is a good
way to handle CSV data.
I put up a small CSV file and demonstrated the FasterCSV aspect. I'd
like to precede that step by automatically bringing up the CSV file in
Excel. (I know I could bring it up manually, but I'd like a self-
contained demo for a computer-illiterate person.)
I've got "fn" set to a string which is the fully qualified name of the
CSV file. I concocted the (failing) command:
SystemCommand.start("Excel", fn)
based on my interpretation of the RDoc for Shell::SystemCommand. I
took a wild stabs to no avail at adding "require 'system'" and
"require 'shel'"
You probably should look at system (its in kernel so no require
needed)
something like:
system "start excel c:\\pathto\\my\\file.csv"
cheers
···
On Oct 25, 1:20 pm, RichardOnRails <RichardDummyMailbox58...@uscomputergurus.com> wrote:
Hi.
I'm writing a small Ruby pgm to demonstrate that FasterCVS is a good
way to handle CSV data.
I put up a small CSV file and demonstrated the FasterCSV aspect. I'd
like to precede that step by automatically bringing up the CSV file in
Excel. (I know I could bring it up manually, but I'd like a self-
contained demo for a computer-illiterate person.)
I've got "fn" set to a string which is the fully qualified name of the
CSV file. I concocted the (failing) command:
SystemCommand.start("Excel", fn)
based on my interpretation of the RDoc for Shell::SystemCommand. I
took a wild stabs to no avail at adding "require 'system'" and
"require 'shel'"
Thanks for your responses. I had some success, but was unable to get
at the content of my Excel file.
Axel, I was able the get an Excel instance and find it's methods.
What I didn't find but think I need it to access the content of a
worksheet.
Chris, I was unable to use "system" to open an Excel file.
Maybe I little dense (or two dense to foll around with Win32OLE.)
Below is the code I fooled around with. If you have any other ideas,
I'd be grateful to receive them.
On Oct 27, 1:57 pm, Chris Hulan <chris.hu...@gmail.com> wrote:
On Oct 25, 1:20 pm, RichardOnRails > > > > <RichardDummyMailbox58...@uscomputergurus.com> wrote:
> Hi.
> I'm writing a small Ruby pgm to demonstrate that FasterCVS is a good
> way to handle CSV data.
> I put up a small CSV file and demonstrated the FasterCSV aspect. I'd
> like to precede that step by automatically bringing up the CSV file in
> Excel. (I know I could bring it up manually, but I'd like a self-
> contained demo for a computer-illiterate person.)
> I've got "fn" set to a string which is the fully qualified name of the
> CSV file. I concocted the (failing) command:
> SystemCommand.start("Excel", fn)
> based on my interpretation of the RDoc for Shell::SystemCommand. I
> took a wild stabs to no avail at adding "require 'system'" and
> "require 'shel'"
Barf! Avoid OLE like the plague. When you're handling large numbers of
Excel files with Win32OLE you more or less need to monopolize Excel's usage
with Ruby. I find I also have large amounts of data stored in Window's
paste board.
On Sat, Oct 25, 2008 at 1:20 PM, Axel Etzold <AEtzold@gmx.de> wrote:
-------- Original-Nachricht --------
> Datum: Sun, 26 Oct 2008 02:24:53 +0900
> Von: RichardOnRails <RichardDummyMailbox58407@uscomputergurus.com>
> An: ruby-talk@ruby-lang.org
> Betreff: Open a MS Excel file from within Ruby
> Hi.
>
> I'm writing a small Ruby pgm to demonstrate that FasterCVS is a good
> way to handle CSV data.
>
> I put up a small CSV file and demonstrated the FasterCSV aspect. I'd
> like to precede that step by automatically bringing up the CSV file in
> Excel. (I know I could bring it up manually, but I'd like a self-
> contained demo for a computer-illiterate person.)
>
> I've got "fn" set to a string which is the fully qualified name of the
> CSV file. I concocted the (failing) command:
>
> SystemCommand.start("Excel", fn)
>
> based on my interpretation of the RDoc for Shell::SystemCommand. I
> took a wild stabs to no avail at adding "require 'system'" and
> "require 'shel'"
>
> I'm running:
> ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
> WinXP-Pro/SP3
>
> TIA,
> Richard
...
# Axel, I was able the get an Excel instance and
# find it's methods. What I didn't find but think I
# need it to access the content of a worksheet.