0
我是Perl新手。谁能告诉我如何将数据从一个excel文件追加到另一个现有的excel文件?使用perl将数据追加到excel
我有2个excel文件,每次运行程序时都会创建1个excel文件,但我需要将数据从新的excel文件复制到另一个作为备份。所以我想将数据追加到备份文件中。
我试过在网上搜索,但我得到的是创建新文件。
我是Perl新手。谁能告诉我如何将数据从一个excel文件追加到另一个现有的excel文件?使用perl将数据追加到excel
我有2个excel文件,每次运行程序时都会创建1个excel文件,但我需要将数据从新的excel文件复制到另一个作为备份。所以我想将数据追加到备份文件中。
我试过在网上搜索,但我得到的是创建新文件。
我想你想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');
谢谢Chankey,但我得到一个错误“在上线./6.pl 16未定义的值‘’无法调用” AddCell。 – VED
分享你写的代码。 –
我想你已经添加了我的代码,这不是你如何做的,它只是一个示例。转到模块页面并查看文档。 –