Spreadsheet::ParseExcel 模块
模块下载地址:
http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spreadsheet/ParseExcel.pm
缺什么模块下载什么模块,安装什么模块, CPAN太强大了
1、 OLE::Storage_Lite
http://search.cpan.org/~jmcnamara/OLE-Storage_Lite-0.19/lib/OLE/Storage_Lite.pm
$ perl Makefile.PL
$ make
$ make test
$ sudo make install
$ make clean
2、Spreadsheet::WriteExcel
http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.40/lib/Spreadsheet/WriteExcel.pm
$ perl Makefile.PL
$ make
$ make test
$ sudo make install
$ make clean
1).Parse::RecDescent
http://search.cpan.org/~jtbraun/Parse-RecDescent-1.967009/lib/Parse/RecDescent.pm
$ perl Makefile.PL
$ make
$ make test
$ sudo make install
$ make clean
3、Crypt/RC4.pm
http://search.cpan.org/~sifukurt/Crypt-RC4-2.02/RC4.pm
$ perl Makefile.PL
$ make
$ make test
$ sudo make install
$ make clean
4、Digest/Perl/MD5.pm
http://search.cpan.org/~delta/Digest-Perl-MD5-1.9/
$ perl Makefile.PL
$ make
$ make test
$ sudo make install
$ make clean
example:
------------------------------------------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
use Spreadsheet::ParseExcel;
my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse('a.xls');
if(!defined $workbook) {
die $parser->error(), " .\n";
}
for my $worksheet ($workbook->worksheets()) {
my ($row_min, $row_max) = $worksheet->row_range();
my ($col_min, $col_max) = $worksheet->col_range();
for my $row ($row_min .. $row_max) {
for my $col ($col_min .. $col_max) {
my $cell = $worksheet->get_cell($row, $col);
next unless $cell;
print "Row, Col = ($row, $col)\n";
print "Value = " . $cell->value() . "\n";
print "Unformatted = " . $cell->unformatted() . "\n";
print "\n";
}
}
}