#!/usr/bin/perl -w use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $ExcelFile = 'C:\path\to\an\excel.xls'; my $PDF_out = 'output.pdf'; my $Printer = 'Win2PDF'; my $Excel = Win32::OLE->new('Excel.Application', 'Quit') or die Win32::OLE->LastError; $Excel->{Visible} = 1; my $Book = $Excel->Workbooks->Open( # Filename,[UpdateLinks],[ReadOnly],[Format],[Password],[WriteResPassword], # [IgnoreReadOnlyRecommended],[Origin],[Delimiter],[Editable],[Notify],[Converter],[AddToMru] $ExcelFile,undef,undef,undef,undef,undef, undef,undef,undef,undef,0,undef,0); $Book->PrintOut( #[From],[To],[Copies],[Preview],[ActivePrinter],[PrintToFile],[Collate],[PrToFileName] undef,undef,undef,undef,$Printer,undef,undef,$PDF_out); $Book->Close(0); $Excel->Quit();