通过shell脚本从Excel文件中读取

时间:2014-06-23 11:41:05

标签: linux excel perl shell

我正在尝试运行一个从excel文件获取输入并处理相同内容的脚本。但是在运行perl脚本时出现以下错误:

Can't locate Spreadsheet/WriteExcel.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at excel_write.pl line 4.
BEGIN failed--compilation aborted at excel_write.pl line 4.

我的代码:

use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new("test.xls");
my $worksheet = $workbook->add_worksheet();
open(FH,"<file") or die "Cannot open file: $!\n";
my ($x,$y) = (0,0);
while (<FH>){
 chomp;
 @list = split /\s+/,$_;
 foreach my $c (@list){
    $worksheet->write($x, $y++, $c);
 }
 $x++;$y=0;
}
close(FH);
$workbook->close();

我在我的机器上安装了perl。请帮我解决这个问题。提前谢谢

0 个答案:

没有答案