Perl读取Excel表格中的数据

| 暂无评论 | 暂无引用通告

--> #!/usr/bin/perl -w
use strict;
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::FmtUnicode;

#创建一个表格解析对象
my $oExcel = new Spreadsheet::ParseExcel;
die "You must provide a filename to $0 to be parsed as an Excel file" unless @ARGV;
 #设定格式转码
my $oFmtC = Spreadsheet::ParseExcel::FmtUnicode->new(Unicode_Map=>"CP936");
#解析文件,文件名为传给脚本的第一个参数
my $oBook = $oExcel->Parse($ARGV[0],$oFmtC);
#表格文件中的表序
my $iSheet=0;
#获得表格文件的第一张表
my $worksheet=$oBook->{Worksheet}[$iSheet];
#获取指定表中的值 列序、列序的始值为0
my $value=$worksheet->{Cells}[行序][列序]->Value;

另外看这里:
http://blog.chinaunix.net/u/14845/showart_80678.html
http://www.ibm.com/developerworks/cn/linux/sdk/perl/culture-8/index.html

暂无引用通告

发送引用通告网址: http://supersun.info/mt/mt-tb.cgi/914
如果您想引用这篇日记到您的Blog,请复制上面的链接,放置到您发表文章时的相应界面中。

发表评论

最新资源

  • IMG_1437.JPG
  • line.png
  • bar.png
  • perl_calander.jpg

关于此日记

此日记由 supersun 发表于 2009年1月14日 16:09

此Blog上的上一篇日记使用Perl生成excel表格

此Blog上的下一篇日记用逗号替换换行符

首页归档页可以看到最新的日记和所有日记。