We can generate an excel using the module Spreadsheet::WriteExcel.
Ex:-
#!/usr/bin/perl -w
use CGI;
use DBI;
use Data::Dumper;
use Spreadsheet::WriteExcel;
use vars qw(%GLOBALS %GLOB $dbh $q);
$q = new CGI;
my $time=time();
# Create a new workbook called simple.xls and add a worksheet.
my $workbook = Spreadsheet::WriteExcel->new("$time.xls");
#$format_bold_ul->set_bg_color('gray');
my $worksheet = $workbook->add_worksheet();
for(my $i=0;$i<10;$i++)
{
my %font = (
font => 'Arial',
size => 12,
color => 'blue',
bold => 1,
align => 'center',
valign => 'vcenter'
);
$format_bold_ul = $workbook->add_format(%font);
for(my $j=0;$j<6;$j++)
{
$worksheet->write($i, $j, qq{$i - $j}, $format_bold_ul);
}
}
For more details go to http://search.cpan.org/search?query=Spreadsheet%3A%3AWriteExcel&mode=module