Carlos Diaz wrote: > Help me please ! > Hello, I have some Excel files, I want to pass them to only one file, using > win32::ole and perl . ( not cell by cell , loss the format). > Thanks a lot >
I'm sure you want this to work on multiple files and sheets but the following will get you going:- use strict; use warnings; use Win32::OLE; my ($file1, $file2) = ('C:\Temp\file1.xls', 'C:\Temp\file2.xls'); my $excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $excel->{Visible} = 1; my $book1 = $excel->Workbooks->Open($file1); my $sheet1 = $book1->Worksheets(1); my $book2 = $excel->Workbooks->Open($file2); my $sheet2 = $book2->Worksheets(2); $sheet1->Copy({Before => $sheet2}); __END__ Note that $file2 needs to exists first - however creating a blank Excel file is trivial. $book->Worksheets can have its argument as a string to an actual sheet name rather than the default Sheet1 Think you could swing some Coronas my way? That's a great beer man. Just in _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs