https://bz.apache.org/bugzilla/show_bug.cgi?id=68305
Bug ID: 68305 Summary: Invalid sheetIndex Error in formulaEvaluator.evaluate(cell) for Cell Formula with Escaped Apostrophe in Sheet Name Product: POI Version: 5.2.3-FINAL Hardware: Macintosh OS: other Status: NEW Severity: normal Priority: P2 Component: XSSF Assignee: dev@poi.apache.org Reporter: ali.haider.s...@gmail.com Target Milestone: --- Issue Summary: When using Apache POI's formulaEvaluator.evaluate(cell) method, an Invalid sheetIndex: -1 error is thrown for a cell formula referencing a sheet name that contains an apostrophe. The sheet name is properly escaped as per standard Excel syntax, yet the error persists. Detailed Description: We have an Excel sheet named (2) 4-Tension Bolt MC's. In our Java application using Apache POI, we're attempting to evaluate a cell that references this sheet. The cell formula is written as ='(2) 4-Tension Bolt MC''s'!C4, with the apostrophe in the sheet name correctly escaped using a double apostrophe (''). This formula works as expected when used directly in Microsoft Excel. However, when evaluating this cell using Apache POI's FormulaEvaluator, it results in the following error: Invalid sheetIndex: -1. This suggests an issue with how Apache POI is handling sheet names with escaped apostrophes in formulas. Steps to Reproduce: Create an Excel sheet named (2) 4-Tension Bolt MC's. In a cell of another sheet, input the formula ='(2) 4-Tension Bolt MC''s'!C4. Use Apache POI's FormulaEvaluator to evaluate this cell in a Java application. Observe the Invalid sheetIndex: -1 error. Expected Behavior: The formula should be evaluated without errors, similar to how it functions in Microsoft Excel. Actual Behavior: An Invalid sheetIndex: -1 error is thrown, indicating an issue with parsing the sheet name with an escaped apostrophe. Code: CellValue formulaResult = formulaEvaluator.evaluate(cell); -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org