Sep 01 2023 03:34 AM
Hi,
I am having trouble working out how I would do something like this:
It appears that the state of the python context is completely wiped between recalculations. I am trying to find a way (ANY way) of storing some state across recalculations which can affect that state itself. As a simple proof of concept, Conway's Game of Life. This requires updating a range of cells based upon that range itself which seemingly cannot happen despite there being no actual technical limitation to stop it other than a needlessly imposed inability to modify existing data which makes no sense. I simply cannot find any way to store the state of the grid across iterations without a circular reference. Variables are wiped upon recalculation so i'm a bit lost.
As it stands I cannot find a way to do this. the xl function appears to take a hardcoded value for cell range, so I cannot fetch cell data dynamically, and any kind of circular reference just doesn't work.
All in all I was looking forward to python being added to excel but it's so limited with this problem that I really hope there is SOME kind of workaround. The concept of having an excel spreadsheet with python code is very appealing but with this limitation it's really not much better than using existing formulas...
Sep 01 2023 07:33 AM - edited Sep 01 2023 07:34 AM
It may help to send the Excel team feedback through File | Feedback. Python functionality started rolling out to insiders a week ago so MS could use the feedback. I'm an insider and don't yet have access to Python within Excel.
Sep 01 2023 08:22 AM