Quote:
Originally Posted by rejeesh
Hi all,
I have never used perl before, so I request your help.
I have an excel document. I am looking for a perl script that does the following.
1. Open the excel doc
Inside a loop
2. Copy existing sheet to another one and rename the sheet
3. Insert values into 3 columns
exit loop
4. Save the excel file
Could you please help? I appreciate you help.
|
start with this, and see how far you can get

{code}
use warnings;
use strict;
use OLE;
my $excel = CreateObject OLE 'Excel.Application' or die $!;
$excel->{'Visible'} = 1;
my $workbook = $excel -> Workbooks -> Add;
$workbook -> ActiveSheet -> Range('A1')->{'Value'} = "Hello";
$workbook -> ActiveSheet -> Range('C2: D3')->{'Value'} = [
['one', 'two' ],
['three', 'four'],
];
$workbook -> SaveAs ('C:\\perl.xls') or die $!;
$excel -> Quit;
{code}