Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Stranger in a Strange land

by Jonathan (Curate)
on Jun 06, 2000 at 16:26 UTC ( #16588=perlquestion: print w/replies, xml ) Need Help??
Jonathan has asked for the wisdom of the Perl Monks concerning the following question:

I've been forced to do some work on a NT box. Luckily perl has come with me.

I want to create excel spreadsheets (with a little tarting up) from downloaded datafiles.
I've seen some basic OLE examples but they were always very simple.
Is there any documentation available that covers anything I may want to do?

Can anyone help?

Replies are listed 'Best First'.
(jcwren) Re: Stranger in a Strange land
by jcwren (Prior) on Jun 06, 2000 at 18:47 UTC
    There is a CPAN module by John McNamara called SpreadSheet::Excel. It only allows inserting text and numbers into cells (i.e. no formatting, no formulas, etc, etc).

    I have a large database on a Linux box that has to be able to download Excel spreadsheets containing the data. I'm lucky in that I don't have to do anything other than just numbers and text with this. However, I'd love to have a full-blown module that would allow cell formatting, fomulas, the works.

    I've thought about writing one, but everyting I think about starting I get put off by the fact that it's a Microsoft product, and the docs for the Excel format are ambigious.

    Maybe John's module will do all you need, however...

OLE IDispatch access with Perl
by Corion (Pope) on Jun 06, 2000 at 17:36 UTC

    I haven't done it myself, but the Win32::Ole documentation looks quite simple (simple of course, if you know the Excel "object model")...

    The MSDN has some documentation on the Excel object model, as has the Office Development Kit, something you might want to buy if you do Office development on a regular basis...

    Some code from the top of my head - I haven't done Excel automation for a looong time ... Note that you can take the method and object names from any VB code, as both Perl and VB call through the IDispatch methods of Excel.

    $ex = Win32::OLE->new('Excel.Application') or die "oops\n"; $ex->Worksheets(0)->Cells(0,0) = "Hello world";

    I'm not sure about the parameters you have to pass to the Cells function - some VB sample code should be easy to port though.

      Thanks for that,

      Simple things do appear fairly straight forward, guess I'll have to bite the bullet and take on the Excel object model.
Re: Stranger in a Strange land
by t0mas (Priest) on Jun 07, 2000 at 10:44 UTC
    Maybe this previous discussion will help you. Use the simple OLE examples and the VB object browser and you will quickly get the hang of it...

    /brother t0mas

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://16588]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-06-24 06:03 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.