in reply to Perl -CGI -Excel
Spreadsheet::WriteExcel is the module you want. Here is a link to some examples http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.37/lib/Spreadsheet/WriteExcel/Examples.pm