in reply to Is there a way to embed Word or other Office applications into my perl app?
use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); # Open Excel file my $Book = $Excel->Workbooks->Open("C:\\Temp\\ExcelFile.xls"); # Select worksheet number 1 my $Sheet = $Book->Worksheets(1); # Get the contents my $array = $Sheet->Range("B5:AT5")->{'Value'}; $Book->Close; foreach my $ref_array (@$array) { foreach my $scalar (@$ref_array) { print "$scalar\t"; } print "\n"; }
|
|---|