Excel spreadsheet

Discussion in 'Ruby' started by Paatsch, Bernd, Feb 7, 2006.

  1. ------_=_NextPart_001_01C62B86.C4A8501A
    Content-Type: text/plain

    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

    ------_=_NextPart_001_01C62B86.C4A8501A--
     
    Paatsch, Bernd, Feb 7, 2006
    #1
    1. Advertising

  2. Paatsch, Bernd

    John Maclean Guest

    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
    +0900 "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



    --
    John Maclean
    MSc (DIC)
    07739 171 531
     
    John Maclean, Feb 7, 2006
    #2
    1. Advertising

  3. D=C5=88a Utorok 07 Febru=C3=A1r 2006 02:36 Paatsch, Bernd nap=C3=ADsal:
    > 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, y=
    our=20
    best bet is probably using Win32OLE and accessing an Excel interface via CO=
    M.=20
    Best look at Win32OLE, and Windows / Excel automation docs.

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

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

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

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

    David Vallner
     
    David Vallner, Feb 7, 2006
    #3
  4. Paatsch, Bernd

    Gene Tani Guest

    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.
     
    Gene Tani, Feb 7, 2006
    #4
  5. 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
     
    Jon Egil Strand, Feb 7, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. FSD
    Replies:
    0
    Views:
    1,191
  2. Tim Marsden

    Displaying an Excel spreadsheet

    Tim Marsden, Feb 20, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,655
    S. Justin Gengo
    Feb 20, 2004
  3. =?Utf-8?B?S2VpdGhSYWdpbkZAbmV3c2dyb3Vwcy5ub3NwYW0=

    Returning Excel Spreadsheet as web page

    =?Utf-8?B?S2VpdGhSYWdpbkZAbmV3c2dyb3Vwcy5ub3NwYW0=, Apr 23, 2004, in forum: ASP .Net
    Replies:
    10
    Views:
    2,749
    Steven Cheng[MSFT]
    May 6, 2004
  4. Roger Twomey
    Replies:
    1
    Views:
    12,614
    Roger Twomey
    Apr 27, 2004
  5. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,512
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
Loading...

Share This Page