Alternately, you could use
Excel::Template, which uses
Spreadsheet::WriteExcel.
use Excel::Template;
my $template = Excel::Template->new(
filename => 'template.xml',
);
$template->param(
hello => 'Hi Excel!',
value => 1.2345,
formula => '=SIN(PI()/4)',
);
$template->write_file('perl.xls');
--------
template.xml
--------
<workbook>
<worksheet>
<row>
<bold>
<cell><var name="hello" /></cell>
</bold>
<cell col="+1" text="$value" />
<formula><var name="formula" />
</row>
<cell row="1" col="0"><var name="hello" /></cell>
</worksheet>
</workbook>
I don't have all the formatting options built in, yet, but the rest of it works. It takes the same data structure as HTML::Template, so it's really good for building reports. (My current job has me using HTML::Template, Excel::Template, PDF::Template, and Graph::Template for this very purpose.)
------
We are the carpenters and bricklayers of the Information Age.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.