- 论坛徽章:
- 0
|
不加载宏的可以打印,加载的就打印不出来,究竟怎样才能处理加载宏的excel文件?
- use strict;
- use Spreadsheet::ParseExcel;
- use Encode;
- die "You must provide a filename to $0 to be parsed as an Excel file" unless @ARGV==1;
- my $file=shift;
- my %count;
- my $excel = Spreadsheet::ParseExcel::Workbook->Parse($file);
- foreach my $sheet (@{$excel->{Worksheet}}[0..2]) {
- printf("Sheet: %s\n", $sheet->{Name});
- foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
- my $cell = $sheet->{Cells}[$row][1];
- if ($cell) {
- $count{decode('GB2312',$cell->{Val})}++;
- #printf("( %s , %s ) => %s\n", $row, 5, $cell->{Val});
- }
- }
- }
- for my $c(sort keys %count)
- { print "$c,$count{$c}\n"; print "haha\n";}
复制代码 |
|