We need to add support for Absolute Cell References, and then also Named Ranges (basically cell aliases) in our formula parsing. Luckily, these wouldn't be extremely difficult to handle.
ABS Refs:
They can be handled mostly the same as normal cell refs but with an added layer of saying whether the column or row is an absolute ref (or both). So we can just add one more dictionary flag to set True or False on for both of those. Then when reconstructing we can take this value and put the $ where it needs to be before any refs in the repr string.
Named Ranges
This will be quite a bit harder. We can classify these unknown strings as cell refs but with another flag of "alias" set to True to denote whether this cell ref is an alias or not. If we have an alias cell ref then we don't want the user to change it in any way because changing it in the formula structure won't change it in the overall excel sheet. But we still want to be able to use it and move it around the formula as needed.
We could have the user pass in an optional workbook and / or worksheet argument into the formula init method which could then grab all the cell reference aliases which we could cross reference when parsing the formula to find matches. So that could be a decent solution, but then it further relies on the Openpyxl library to make this whole code work. I don't like the idea of relying too heavily on openpyxl for this project, but for some things it seems unavoidable.
All in all, these changes will take significant testing to get right but are crucial in handling complex formula parsing, else this library will not be useful to its target audience. It needs to be done before it can be effectively used. But at least for most formulas this library works well enough.
We need to add support for Absolute Cell References, and then also Named Ranges (basically cell aliases) in our formula parsing. Luckily, these wouldn't be extremely difficult to handle.
ABS Refs:
Named Ranges
All in all, these changes will take significant testing to get right but are crucial in handling complex formula parsing, else this library will not be useful to its target audience. It needs to be done before it can be effectively used. But at least for most formulas this library works well enough.