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

i am getting the output: 0 0 that means its giving 0 rows, 0 cols, and no string in name. the code is below:
#!usr/bin/perl print "content-type:text/html\n\n"; use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use Spreadsheet::ParseExcel; my $obook= Spreadsheet::ParseExcel::Workbook->Parse('Excel//home/www/x +xxxxxxxxxxxxxxxxxxx.org/excel/yyyyyyyyyyyyyyy') or die "error: $!"; my $osheet =$obook->{worksheet}[1]; my $sheetname = $osheet->{Name}; my $rows= ($osheet->{minrow}) - ($osheet->{marrow}); my $cols= ($osheet->{mincol}) - ($osheet->{maxcol}); print "$sheetname $rows $cols";
also, when i saw the list of installed modules on the webserver which im using, it didnt have any module like this: spreadsheet::parseexcel, although there was module called spread, and some others like this : spreadsheet::parseexcel::<something>. but thr was none like this much: spreadsheet::parseexcel. however, when i run this script it doesnt give me an error that cannot find module etc....????

Replies are listed 'Best First'.
Re: no output of spreadsheet
by ysth (Canon) on Jul 04, 2008 at 07:05 UTC
    There appears to be a bug in Spreadsheet::ParseExcel::Workbook where it loses track of the error returned by Spreadsheet::ParseExcel->Parse, and returns an unblessed hash containing a Spreadsheet::ParseExcel object. This bug keeps the rest of your code from dieing, though it doesn't have any data since the Parse failed.

    The shebang line should be "#!/usr/bin/perl".

    The content type line should be "Content-Type: text/html\n\n" (note the capitalization and spacing) though browsers may parse this loosely for you.

    The filename shouldn't have the "Excel/" at the beginning. It's also possible that the filename isn't reachable at that same location through the webserver, or the webserver doesn't have permission to read the file. my $obook= Spreadsheet::ParseExcelorkbook->Parse('/home/www/artoflivingdelhi.org/excel/INFOSHEET_5TH_SEPT07.xls')

      removing excel before the file name solved the prob. thanx :)
Re: no output of spreadsheet
by Your Mother (Archbishop) on Jul 04, 2008 at 06:53 UTC

    Just a guess. Perhaps this-

    my $osheet = $obook->{worksheet}[1]; # 2nd page

    Should be-

    my $osheet = $obook->{worksheet}->[0]; # 1st page