in reply to Error while reading .xls file
You're not closing your Excel file after writing to it. Add an explicit $workbook->close() before calling get_max_row_col(), and your script will work.
While I'm at it, allow me to suggest doing proper error checking, too. Quoting Spreadsheet::ParseExcel's documentation (emphasis mine):
If an error occurs parse() returns undef. In general, programs should contain a test for failed parsing as follows:
my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('Book1.xls'); if ( !defined $workbook ) { die $parser->error(), ".\n"; }
Adding error checking to your code then yields:
No Excel data found in file at 1098852.pl line 32.
Which might already have given you a clue as to what's going wrong.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Error while reading .xls file
by a.alandkar (Novice) on Aug 29, 2014 at 18:01 UTC | |
by AppleFritter (Vicar) on Aug 29, 2014 at 18:45 UTC | |
by a.alandkar (Novice) on Aug 31, 2014 at 10:15 UTC | |
by AppleFritter (Vicar) on Aug 31, 2014 at 13:17 UTC | |
by soonix (Chancellor) on Sep 01, 2014 at 20:39 UTC |