Formula reference tree extraction

69 views
Skip to first unread message

Avy Faingezicht

unread,
May 24, 2023, 6:32:38 PM5/24/23
to openpyxl-users
Hello,

I'm a new user of the library. I've been playing around with the API, and reading the documentation couldn't find anything about a workbook's internal reference tree. Is this something that can be extracted given an input excel file?

In the simplest case, I'd have something like a workbook with
cell A1: 10
cell A2: 20
cell A3: =sum(A1, A2)

and spit out a structured DAG saying that A3 depends on A1 and A2. I imagine parsing formulas in every cell and recursively constructing that dependency tree wouldn't be too complicated for the base cases. Does such a feature exist?

Thanks!


Charlie Clark

unread,
May 25, 2023, 4:42:32 AM5/25/23
to openpyxl-users
Openpyxl doesn't have any kind of dependency graph. It's a library for reading and writing the file format only. Other libraries that do what you would like may exist, but really this kind of functionality is best handled by applications like MS Excel or OpenOffice.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226
Reply all
Reply to author
Forward
0 new messages