1

Using certain old versions of ActivePerl, reading a spreadsheet:

use Spreadsheet::ParseExcel;
$excel = Spreadsheet::ParseExcel::Workbook->Parse("some file");
foreach $sheet (@{$excel->{Worksheet}}){
  print $sheet->get_name(); 
}

Error: Can't locate object method get_name() spreadsheet::parseexcel::worksheet

Also $sheet->{name} doesn't give anything.

3 Answers 3

1
foreach my $sheet ($excel->worksheets) {
    print $sheet->get_name;
}

works. You are supposed to call the worksheets method to get at the Worksheets objects.

1

Versions of Spreadsheet::ParseExcel prior to 0.43 (January 2009) didn't have a get_name() method.

If you upgrade to a recent version of Spreadsheet::ParseExcel then your code will work. I tested it.

However, Spreadsheet::ParseExcel::Workbook->Parse() is now deprecated since it doesn't do error checking. Use Spreadsheet::ParseExcel->Parse() instead.

0

$sheet->{Name} (with uppercase) gives the name, in v0.49 of ParseExcel

1
  • there's no API to bypass in that version
    – OJW
    Jul 30, 2012 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.