The Spreadsheet::WriteExcel module can be used to write data to an Excel spreadsheet. Be aware that this will overwrite the entire spreadsheet with the new data. If your goal is to instead append or replace data in an Excel spreadsheet, you will want to TBD.
Install the Spreadsheet::WriteExcel module. Import the Spreadsheet::WriteExcel module into your Perl script.
These two lines are used to define the spreadsheet you are going to write to (example.xls in this example).
my $workbook = Spreadsheet::WriteExcel->new('example.xls'); my $worksheet = $workbook->add_worksheet();
This will write the text "Hello World" into cell A1 in Sheet1 of the Excel spreadsheet.
$worksheet->write('A1', 'Hello World');