A customer-provided Excel document contained a Formula referencing a second file using a formula like
```
='C:\Temp\[A.xlsx]Country'!$A$3
```
which results in a `System.Exception`: Identifier expected.
at
```
at ClosedXML.Excel.CalcEngine.CalcEngine.Throw(String msg)
at ClosedXML.Excel.CalcEngine.CalcEngine.GetToken()
at ClosedXML.Excel.CalcEngine.CalcEngine.ParseExpression()
at ClosedXML.Excel.CalcEngine.CalcEngine.Parse(String expression)
at ClosedXML.Excel.CalcEngine.ExpressionCache.get_Item(String expression)
at ClosedXML.Excel.CalcEngine.CalcEngine.Evaluate(String expression)
at ClosedXML.Excel.XLWorksheet.Evaluate(String expression)
at ClosedXML.Excel.XLCell.get_Value()
at ClosedXMLRepro.Program.Main(String[] args) in ClosedXMLRepro\Program.cs:line 31
```
As documented in issues like https://closedxml.codeplex.com/workitem/9402 there seems to be an issue with the formula parser if single quotes are involved. It looks like there is currently no (easy?) way to check for formula validity before accessing a cell value. I don't suspect that cross file references are supported at all.
I was hoping for a way to validate a formula or a defined set of distinct Exception types (e.g. like UnsupportedFormulaException, SyntaxException) to be able to better distinguish what is going on.
```
='C:\Temp\[A.xlsx]Country'!$A$3
```
which results in a `System.Exception`: Identifier expected.
at
```
at ClosedXML.Excel.CalcEngine.CalcEngine.Throw(String msg)
at ClosedXML.Excel.CalcEngine.CalcEngine.GetToken()
at ClosedXML.Excel.CalcEngine.CalcEngine.ParseExpression()
at ClosedXML.Excel.CalcEngine.CalcEngine.Parse(String expression)
at ClosedXML.Excel.CalcEngine.ExpressionCache.get_Item(String expression)
at ClosedXML.Excel.CalcEngine.CalcEngine.Evaluate(String expression)
at ClosedXML.Excel.XLWorksheet.Evaluate(String expression)
at ClosedXML.Excel.XLCell.get_Value()
at ClosedXMLRepro.Program.Main(String[] args) in ClosedXMLRepro\Program.cs:line 31
```
As documented in issues like https://closedxml.codeplex.com/workitem/9402 there seems to be an issue with the formula parser if single quotes are involved. It looks like there is currently no (easy?) way to check for formula validity before accessing a cell value. I don't suspect that cross file references are supported at all.
I was hoping for a way to validate a formula or a defined set of distinct Exception types (e.g. like UnsupportedFormulaException, SyntaxException) to be able to better distinguish what is going on.