我強烈建議Spreadsheet::WriteExcel爲您的需要。該庫完全用Perl編寫,因此您只需將CPAN庫上傳到您的網站並指定具體位置即可。下面的庫文檔和代碼片段將幫助您開始。
#!/usr/bin/perl -w
use strict;
use lib qw(./lib); # Place for the downloaded WriteExcel library
use Spreadsheet::WriteExcel;
# Send headers
print "Content-type: application/vnd.ms-excel\n";
print "Content-disposition: attachment;filename=rollcharts.org.xls\n\n";
# Create a new workbook and add a worksheet
my $workbook = Spreadsheet::WriteExcel->new("-");
my $worksheet = $workbook->add_worksheet("Colorful Example");
# Create a new format with red colored text
my $format = $workbook->add_format();
$format->set_color('red');
# Add header
$worksheet->write(0, 0, "Fruit.", $format);
$worksheet->write(0, 1, "Cost", $format);
# Add Data
$worksheet->write(1, 0, "Apple");
$worksheet->write(1, 1, "10.25");
# Close Workbook
$workbook->close();
您是否嘗試過使用Google搜索「perl excel」?我發現在這個主題上有很多很好的教程。 – 2009-12-02 16:01:08