Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: excel and OLE

by t0mas (Priest)
on Nov 26, 2002 at 08:15 UTC ( [id://215800]=note: print w/replies, xml ) Need Help??


in reply to excel and OLE

If starting Excel on _another_ Win32 box is an option, you can try the following stunt.
use Win32::OLE; my $excel = Win32::OLE->new(['172.16.12.100','Excel.Application']) or die "Can't start excel: $!"; my $workbook = $excel->Workbooks->Open('c:\test.xls') or die "Can't open file: ",Win32::OLE->LastError(); my $sheet = $workbook->Worksheets(1) or die "Can't open sheet: ",Win32::OLE->LastError(); my $everything=$sheet->UsedRange()->{Value} or die "Can't get range: ",Win32::OLE->LastError(); for (@$everything) { for (@$_) { print defined($_) ? "$_|" : "<undef>|"; } print "\n"; } $excel->Quit;
This code will start Excel on 172.16.12.100 (a box with MS Office installed) using DCOM and open the file c:\test.xls (c:\test.xls on 172.16.12.100 !!!) and print a delimited output of the first worksheet.

Can't think of a thinner way to do it ;-)

/brother t0mas

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://215800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-19 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found