#!/usr/bin/perl -w use diagnostics; use diagnostics -verbose; use strict; use Cwd; use Win32::OLE; use Win32::OLE::Const "Microsoft Excel"; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{Visible} = 1; $Excel->{DisplayAlerts} = 0; my $dir = cwd(); $dir =~ s/\//\\/g; my $path = $dir . "\\PerlMonksTest.xml"; my $Book = $Excel->Workbooks->OpenXML($path); $Book->Activate; my $new_file= $dir . "\\PerlMonksTestWB.xlsx"; if(-e $new_file) {unlink $new_file or die "Could not remove '$new_file': $!\n";} $Book->SaveAs( {Filename => "$new_file", FileFormat => 'xlOpenXMLWorkbook', CreateBackup => 'False'} ); #$Book->SaveAs( {Filename => "$new_file"} );