luckyluke has asked for the wisdom of the Perl Monks concerning the following question:

I use the perl module Spreadsheet::ParseExcel and it works really great. Last week i've got a problem with a special kind of Exel-Files. There are seven Worksheets with data (numbers) and three with diagrams. When I print out the contents of an Excel file with the sample script dmpEx.pl the data from the last worksheet appears in first worksheet. Here is the sample script from the author of the module
use strict; if(!(defined $ARGV[0])) { print<<EOF; Usage: $0 Excel_File EOF exit; } use Spreadsheet::ParseExcel; my $oExcel = new Spreadsheet::ParseExcel; my $oBook = $oExcel->Parse($ARGV[0]); my($iR, $iC, $oWkS, $oWkC); print "=========================================\n"; print "FILE :", $oBook->{File} , "\n"; print "COUNT :", $oBook->{SheetCount} , "\n"; print "AUTHOR:", $oBook->{Author} , "\n"; #for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { # $oWkS = $oBook->{Worksheet}[$iSheet]; foreach my $oWkS (@{$oBook->{Worksheet}}) { print "--------- SHEET:", $oWkS->{Name}, "\n"; for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) + { for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxC +ol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC); print $oWkC->{_Kind}, "\n"; } } }
This error occurs when the last worksheet with data is placed in the Excel File behind the worksheets with diagrams. When the diagrams are at the end of the Excel File then it works fine. I don't know is there a bug in the perl module or maybe this is an Excel bug ? I use Excel2000 on Windows XP SP1 and perl v5.8.5 on SUSE Linux 9.2 and Spreadsheet-ParseExcel-0.2603. I am sorry about my bad english, i hope you understand what is the problem i have. :) Maybe you have some time to have a look at this problem.

Replies are listed 'Best First'.
Re: trouble with Spreadsheet::ParseExcel
by luckyluke (Initiate) on Sep 06, 2005 at 06:25 UTC
    Hello again, Is there someone in the monastery who can help me please :) I have a sample Excel File where this bug occurs. If you know the Spreadsheet::ParseExcel modul and you want to have a look at this problem please contact me at lukaszek@freenet.de Thanks luckyluke