VED
VED

Reputation: 13

Append data to excel using perl

I am new to Perl.Can anyone tell me how to append data from one excel file to another existing excel file?

I have 2 excel files and 1 excel file is created every time I run the program but I need to copy the data from new excel file to another one as a backup. so I want to append the data to the backup file.

I tried searching in web but all i am getting is creating new files.

Upvotes: 0

Views: 2493

Answers (1)

Chankey Pathak
Chankey Pathak

Reputation: 21666

I think you want Spreadsheet::ParseExcel::SaveParser

# Open an existing file with SaveParser
my $parser   = Spreadsheet::ParseExcel::SaveParser->new();
my $template = $parser->Parse('template.xls');
my $row  = #Enter row value here, keep incrementing it for appending
my $col  = #Enter column value here
# Add a cell
$worksheet->AddCell( $row, $col, 'New string' );
# Write over the existing file or write a new file.
$template->SaveAs('newfile.xls');

Upvotes: 2

Related Questions