#!/usr/bin/perl -w
use CGI qw( :standard);
use Spreadsheet::ParseExcel;
# The new objects
my $q = new CGI;
my $oExcel = Spreadsheet::ParseExcel->new( CellHandler => \&cell_handl
+er,
NotSetCell => 1 );
# McNamara's alternative cell handler
sub cell_handler {
my $workbook = $_[0];
my $sheet_index = $_[1];
my $row = $_[2];
my $col = $_[3];
my $cell = $_[4];
print $cell->{Val} , "
";
}
# The header
print $q->header( -type => "text/html");
# Starting the cronometer
$start = (times) [0];
# The reading
# my $file = "z4kjasdf.xls";
my $file = "acervo15k.xls";
# my $file = "teste1.xls";
my $oBook = $oExcel->Parse($file);
my($iR, $iC, $oWkS, $oWkC);
my @thisrow;
# Just the first worksheet...
$oWkS = $oBook->{Worksheet}[0];
for ( $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS-
+>{MaxRow}; $iR++) {
@thisrow = ();
for ( $iC = $oWkS->{MinCol}; defined $oWkS->{MaxCol} && $iC <= $oWk
+S->{MaxCol}; $iC++) {
$oWkC = $oWkS->{Cells}[$iR][$iC];
if ($oWkC) {
push (@thisrow, $oWkC->{Val});
}
}
my ($col1, $col2, $col3, $col4, @othercols) = @thisrow;
print "$col1
";
}
# Ending the cronometer
$end = (times) [0];
print "$iR rows read in " , $end-$start , " seconds";