in reply to Perl Excel Formulas With Worksheet Links


From the syntax and the error I'm going to guess that you are using the Spreadsheet::ParseExcel::SaveParser module.

Spreadsheet::ParseExcel::SaveParser is a combination of Spreadsheet::ParseExcel and Spreadsheet::WriteExcel.

Spreadsheet::WriteExcel requires that you add a worksheet to a workbook before you can reference it in a formula. This is due to the fact that it has to convert the literal sheet name to an index.

However, Spreadsheet::ParseExcel::SaveParser iterates through the worksheets one at a time rewriting any data that it finds. Due to the limitation stated above this methodology fails for formulas.

Here is a quick and dirty patch to fix it. In SaveParser.pm at line 111 change:

for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { my $oWkS = $oBook->{Worksheet}[$iSheet]; my $oWrS = $oWrEx->addworksheet($oWkS->{Name});

to:

for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { my $oWkS = $oBook->{Worksheet}[$iSheet]; $oWrEx->addworksheet($oWkS->{Name}); } for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { my $oWkS = $oBook->{Worksheet}[$iSheet]; my $oWrS = ($oWrEx->sheets())[$iSheet];

--
John.