You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Trying to to load a Spreadsheet with a formula containing a linebreak fails with an exception:
File "/home/ccaveayl/projects/formulas/model2050.py", line 36, in init
self.model = formulas.ExcelModel().loads(str(xlsx_path)).finish()
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/excel/init.py", line 87, in loads
self.load(filename)
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/excel/init.py", line 92, in load
self.pushes(*book.worksheets, context=context)
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/excel/init.py", line 97, in pushes
self.push(ws, context=context)
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/excel/init.py", line 110, in push
self.add_cell(
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/excel/init.py", line 209, in add_cell
cell = Cell(crd, val, context=ctx).compile(references=references)
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/cell.py", line 73, in init
self.tokens, self.builder = self.parser.ast(value, context=context)
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/parser.py", line 53, in ast
token.ast(tokens, stack, builder)
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/tokens/operator.py", line 91, in ast
pred = self.pred
File "/home/ccaveayl/projects/formulas/.venv/lib/python3.9/site-packages/formulas/tokens/operator.py", line 76, in pred
return self._precedences[self.name]
KeyError: '\n'
Describe the bug
Trying to to load a Spreadsheet with a formula containing a linebreak fails with an exception:
To Reproduce
A minimal example is provided by test_line_break.xlsx.
Simply try to load this file with formulas.
Expected behavior
Spreadsheet should load correctly with line break ignored
Screenshots
N/A
Desktop (please complete the following information):
Additional context
I've temporarily resolved this by changing:
formulas/formulas/cell.py
Line 73 in 2f097d2
to
I suspect there is a better approach to resolving however. If you're able to advise on the best approach I'd be happy to put together a PR for this.
The text was updated successfully, but these errors were encountered: