码迷,mamicode.com
首页 > 其他好文 > 详细

安装Perl Excel读取模块

时间:2014-06-18 14:24:23      阅读:373      评论:0      收藏:0      [点我收藏+]

标签:blog   code   http   ext   com   get   

在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 = ", $cell->value(), "\n";
print "Unformatted = ", $cell->unformatted(), "\n";
print "\n";
}
}
}
}

 

 

Row, Col = (600, 11)
Value = 10.23
Unformatted = 10.2332917150066

Row, Col = (600, 12)
Value = 10.02
Unformatted = 10.0205238183467

Row, Col = (600, 13)
Value = 2.12%
Unformatted = 0.0212332110094224

Row, Col = (601, 0)
Value = 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

安装Perl Excel读取模块,布布扣,bubuko.com

安装Perl Excel读取模块

标签:blog   code   http   ext   com   get   

原文地址:http://www.cnblogs.com/kylegui/p/3791454.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!