Hello,
This is the first time I have used this module and i'm having trouble parsing the data.
I have a very simple excel xls document with 2 worksheets completed with test data. I have used the example available from the documentation ( however nothing is displayed.
By debugging, it seems as if the script never enters the first for loop. I have also used data::dumper to view the entire contents of the hash reference and by briefly looking through the output I can see that the test data is there.
I simply want to pull out each individual piece of data.
Any suggestions?
Thank you,
Chris
This is the first time I have used this module and i'm having trouble parsing the data.
I have a very simple excel xls document with 2 worksheets completed with test data. I have used the example available from the documentation ( however nothing is displayed.
By debugging, it seems as if the script never enters the first for loop. I have also used data::dumper to view the entire contents of the hash reference and by briefly looking through the output I can see that the test data is there.
I simply want to pull out each individual piece of data.
Any suggestions?
Code:
#!/usr/bin/perl -w
use strict;
use Spreadsheet::ParseExcel;
use Data::Dumper;
my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->Parse('test.xls');
print Dumper($workbook);
print "test print 1\n";
for my $worksheet ( $workbook->worksheets() ) {
print "test print 2\n";
my ( $row_min, $row_max ) = $worksheet->row_range();
my ( $col_min, $col_max ) = $worksheet->col_range();
for my $row ( $row_min .. $row_max ) {
print "test print 3\n";
for my $col ( $col_min .. $col_max ) {
print "test print 4\n";
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";
}
}
}
Thank you,
Chris