masaccio / numbers-parser

Python module for parsing Apple Numbers .numbers files
MIT License
201 stars 14 forks source link

node type COLON_TRACT_NODE is unsupported #54

Closed barnacle-carnival closed 1 year ago

barnacle-carnival commented 1 year ago

Using Numbers version 13.1 (7037.0.101)

I can reproduce this error by opening up a new document selecting a few cells in a column, and creating it as a SUM(). Numbers works fine, but I get errors like:

/usr/local/lib/python3.11/site-packages/numbers_parser/formula.py:252: UnsupportedWarning: Table 1@[3,1]: node type COLON_TRACT_NODE is unsupported /usr/local/lib/python3.11/site-packages/numbers_parser/formula.py:102: UnsupportedWarning: Table 1@[3,1]: stack too small for SUM

The "stack too small for" error also affects MIN() and MAX() and probably any function which accepts a range.

The actual function code produced is: "SUM(B2:B3)" However, numbers_parser returns only "SUM()" (note the lack of args) from cell.formula

masaccio commented 1 year ago

Looks like cell references changed a lot in 13.x (maybe earlier). There are a lot of unhandled function AST types but I can't find a way to generate them in current Numbers files, so for now the new cell range references are now support.

@barnacle-carnival let me know if v3.10.4 fixes the problems.

masaccio commented 1 year ago

@SheetJSDev FYI on new cell reference types in function ASTs. _NumbersModel. tract_to_row_col_ref should be pretty clear.

barnacle-carnival commented 1 year ago

Version 3.10.4 runs without any errors and my SUM functions now have values in them! Fixed!

Thanks!