in reply to Spreadsheet::BasicRead - Open XLS Error???

File permissions? is the test.xls in the same directory as the cgi file? Does whatever use the cgi run as (IIS user?) have permissions to read the xls file? What happens if you run the scrpit from the command-line?

If that doesn't identify the problem, can you open it directly with Spreadsheet::ParseExcel (which is what Spreadsheet::BasicRead wraps).

Related good node with lots of reference material: Index of Spreadsheet FAQs
  • Comment on Re: Spreadsheet::BasicRead - Open XLS Error???

Replies are listed 'Best First'.
Re^2: Spreadsheet::BasicRead - Open XLS Error???
by awohld (Hermit) on Sep 23, 2005 at 06:05 UTC
    It's not permissions or anything and it's in the same directory as the CGI script. I can save a excel file straight out of WIN2K and use it exactly in the same manner as the text.xls that is posted above and it works fine.

    The test.xls is output from another computer program which can be opened fine by excel, so there's some kind of nuance with test.xls and test.xls appears to be compliant with MS-EXCEL. So I'm wondering if there's something with "Spreadsheet" that makes it bug out when looking at test.xls.

    What's a "Bad File Descriptor"?

    When I use Spreadsheet::ParseExcel I also get errors, here's my code:
    #!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; my $oExcel = new Spreadsheet::ParseExcel; die "You must provide a filename to $0 to be parsed as an Excel file" +unless @ARGV; my $oBook = $oExcel->Parse($ARGV[0]); my($iR, $iC, $oWkS, $oWkC); print "FILE :", $oBook->{File} , "\n"; print "COUNT :", $oBook->{SheetCount} , "\n"; print "AUTHOR:", $oBook->{Author} , "\n" if defined $oBook->{Author}; for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { $oWkS = $oBook->{Worksheet}[$iSheet]; 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->{MaxCol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC); } } }