我想在已存在的excel文件中寫入數據,但我嘗試的代碼是創建一個新工作表並使用數據擦除舊工作表。這是我使用的代碼使用Perl重寫現有的xls文件
#!/usr/bin/perl –w
use strict;
use Spreadsheet::WriteExcel;
# Create a new Excel file
my $FileName = 'Report.xls';
my $workbook = Spreadsheet::WriteExcel->new($FileName);
# Add a worksheet
my $worksheet1 = $workbook->add_worksheet(); #<- My Doubt
# Change width for only first column
$worksheet1->set_column(0,0,20);
# Write a formatted and unformatted string, row and column
# notation.
$worksheet1->write(0,0, "Hello");
$worksheet1->write(1,0,"HI");
$worksheet1->write(2,0,"1");
$worksheet1->write(3,0,"2"); `
如何將當前工作表分配到$worksheet1
。還有一件事是我需要讀取已經存在的特定單元格。 請給我一些指導。謝謝