Bug 62433 - POI cannot evaluate cell from workbook references if it's worksheet name contains a "#" (hash)
Summary: POI cannot evaluate cell from workbook references if it's worksheet name cont...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.15-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-06 16:10 UTC by Alex
Modified: 2018-06-06 16:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2018-06-06 16:10:35 UTC
My excelfile 'ToBeRead' contains a cell which is referencing to another excelfile 'MuchAwesome' via the formula:
='Z:\VerySecret\[MuchAwesome.xlsx]#SoWow'!A1

if I call evaluateCell with a Workbook.getCreationHelper().createFormulaEvaluator() I will be punished by an exception claiming falsely: java.lang.IllegalArgumentException: Invalid sheetIndex: -1.

if I create a worksheet in my referenced Excel that is not using the "#" character like 'SoWow', 
all is fine, but since '#SoWow' seems to be a valid workbook name, this might be an issue?

Fatal error: java.lang.IllegalArgumentException: Invalid sheetIndex: -1.
org.apache.poi.ss.formula.SheetRefEvaluator.<init>(SheetRefEvaluator.java:36)
org.apache.poi.ss.formula.OperationEvaluationContext.createExternSheetRefEvaluator(OperationEvaluationContext.java:136)
org.apache.poi.ss.formula.OperationEvaluationContext.createExternSheetRefEvaluator(OperationEvaluationContext.java:84)
org.apache.poi.ss.formula.OperationEvaluationContext.getRef3DEval(OperationEvaluationContext.java:313)
org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForPtg(WorkbookEvaluator.java:681)
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:552)
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:317)
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:259)
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateFormulaCellEnum(BaseFormulaEvaluator.java:193)

So long,
Alex.