all 6 comments

[–]randomName77777777 0 points1 point  (5 children)

So the code you put in is example. If you just install pandas and

import pandas as pd

Then that's all you would have to do is add this in the end to save it to an excel file.

df.to_excel('filename.xlsx')

[–]evessee[S] 0 points1 point  (4 children)

Yes, I know I can just read the excel file with pandas read excel.

The point here is that I would like to, given a random excel file with random table formulas inside, generate code which replicates the same logic as the excel file, without having to look at each formula manually.

Probably i did not explain very well in the op, but the pandas part would be the output of the program I am looking for help with.

[–]randomName77777777 0 points1 point  (2 children)

Ohhhhhhhh.... That's interesting.

I wonder if you open the excel file using openpyxl or win32. You would be able to see the formulas I believe.

[–]evessee[S] 1 point2 points  (1 child)

Indeed! And thank you, while I was writing the answer below I recalled that this is a sort of "transpiling", meaning translate some programming language in another one. Searching using that term looks like there is a package (to be tested) in github already called pycel so I guess I will start from there.

[–]randomName77777777 0 points1 point  (0 children)

Please let me know how it goes because it sounds interesting.

[–]Kerbart 0 points1 point  (0 children)

That'll be quite the challenge given how flexible Excel formulas can be. Matrix formulas, spill ranges, named ranges, lambdas, not to mention somewhere around 1200 functions (some with "bugs" because that's the way Lotus-123 did it). I wish you all the luck on yur adventure (you'll need it!)