I currently use the <snip> below, but I have had problems with it running
out on a server that I have not been able to determine the cause of.
Sometimes no Excel file is produced, and other times, voila. It works
everytime locally.
if ( $outputXls ) {
$filename = $outputFilename . ".txt";
if ( -f $filename ) {
use Win32::OLE;
use Cwd;
eval {$ex = Win32::OLE->GetActiveObject('Excel.Application')};
die "Excel not installed" if $@;
unless (defined $ex) {
$ex = Win32::OLE->new('Excel.Application', sub
{$_[0]->Quit;})
or die "Cannot start Excel";
}
$ex->Workbooks->OpenText($filename);
$book = $ex->Workbooks($outputBasename . ".txt");
$sheet = $book->Worksheets(1);
$sheet->Columns("B:BZ")->Autofit;
$xlsFilename = $outputFilename . ".xls";
$book->SaveAs($xlsFilename, 1);
$book->Close(0);
undef $sheet;
undef $book;
undef $ex;
}
}
-----Original Message-----
From: Bob Showalter [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 1:12 PM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: Perl module to operate on MS Excel files
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 08, 2002 1:03 PM
> To: [EMAIL PROTECTED]
> Subject: Perl module to operate on MS Excel files
>
>
> Hello,
>
> I need to automate the extraction and insertion of cells from
> and into an
> Excel
> spreadsheet. Has anyone done something along this line?
>
> Currently, this is achieved via {save as}/{parse into} using
> a text or a
> ..csv file.
>
> Thank you.
>
> PS: I am running Perl in UNIX and Excel in WinNt. UNIX and
> NT talk via
> Hummingbird's Exceed
> (which uses supports standard TCP/IP protocol)
>
> Thanks,
>
> William
I have had good results with the Spreadsheet::ParseExcel and
Spreadsheet::WriteExcel modules available on CPAN. These work
fine on UNIX. Note that Spreadsheet::WriteExcel can create
new workbooks, but cannot update existing workbooks, AFAIK.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]