首页 > 代码库 > 安装Perl Excel读取模块

安装Perl Excel读取模块

在Win7上,进入VisualStudio2008的cmd line prompt

perl -MCPAN -e shell

install Spreadsheet::ParseExcel

install Spreadsheet::ParseExcel::FmtUnicode

install Unicode::Map

 

 

不过安装Win32::GUI失败,编译问题

 

参考Perl Excel读取

http://www.cnblogs.com/pangxiaodong/archive/2012/01/30/2331887.html

http://blog.chinaunix.net/uid-34002-id-2131797.html

 

调试通过:

 

#!/usr/bin/perl -w

use strict;
use Spreadsheet::ParseExcel;

my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse(‘carrizo_Fillrate_cl1341425_MCBFM_ONECYCLE.xls‘);

if ( !defined $workbook ) {
die $parser->error(), ".\n";
}

for my $worksheet ( $workbook->worksheets() ) {

printf("Sheet: %s\n", $worksheet->{Name});
if( $worksheet->{Name} =~ /Fillrate/ )
{
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 = "http://www.mamicode.com/, $cell->value(),"\n";
print "Unformatted = ", $cell->unformatted(), "\n";
print "\n";
}
}
}
}

 

 

Row, Col = (600, 11)
Value = http://www.mamicode.com/10.23
Unformatted = 10.2332917150066

Row, Col = (600, 12)
Value = http://www.mamicode.com/10.02
Unformatted = 10.0205238183467

Row, Col = (600, 13)
Value = http://www.mamicode.com/2.12%
Unformatted = 0.0212332110094224

Row, Col = (601, 0)
Value = http://www.mamicode.com/fillrate_texture6_c64_rw_s8d24comp_rw_aa8
Unformatted = fillrate_texture6_c64_rw_s8d24comp_rw_aa8

Sheet: Interfaces_DB
Sheet: Interfaces_TCP
Sheet: MemCtrl
Sheet: CB
Sheet: DB
Sheet: TCPTCC
Sheet: Theoretical
Sheet: Peak Rates
Sheet: Compare
Sheet: EnginePerfHistory
Sheet: Chip_CONF
Sheet: Macros
Sheet: Chip_CONF old

D:\depot\PPV\project\GfxPV_DB\db_script>perl upload_excel.pl