in reply to OLE - Getting all rows from Excel

The following code works fine for me ...
use Win32::OLE; $excel = Win32::OLE->new("Excel.Application"); $excel->{Visible} = 1; $workbook = $excel->Workbooks->Open("test.xls"); $sheet = $workbook->Worksheets(1); $everything=$sheet->UsedRange()->{Value}; for (@$everything) { for (@$_) { print defined($_) ? "$_|" : "<undef>|"; } print "\n"; } $excel->Quit;
/t0mas

Replies are listed 'Best First'.
RE: Re: OLE - Getting all rows from Excel
by httptech (Chaplain) on May 10, 2000 at 15:28 UTC
    That's terrific... Where did you find that? I can't seem to find any good Excel OLE references for Perl beyond the simple "create a worksheet and insert X rows" examples. What do you use as your reference material?
      I actually only use Objectviewer in the Visual Basic Editor...
      There is a good overview of the Excel Object model in the online help.
      Sorry to dissapoint you.

      /t0mas
        No disappointment, I see it now. Just hard to shift from "perldoc" to helpfiles. I was hoping there was some documentation on the web somewhere of a brave Perl programmer venturing into the world of OLE. Maybe I'll have to write that. ;)

        This should be what I need to finish my application. Thanks!