r/excel • 8 • 12d ago

Plugin Python embedded in Excel

Hi All,

This weekend for a bit of fun I built a free / source-available Excel add-in which hosts it's own Python runtime.

You can find a feature runtime and installation guide on the website:

https://sancarn.github.io/xll-python/index.html

fork it here: https://github.com/sancarn/xll-python

But here's an overview:

  • You can write user defined functions which execute like formula.
  • Returning a generator will make the result update every time it yield's a result.
  • You can write macros (e.g. reading / writing CSVs/databases from disk etc.)
  • There's an in-built IDE
  • You can debug formula in the IDE
  • There's a console/REPL where you can experiment with the available runtime
  • There's a package manager where you can install pip packages
  • There's a compiler so you can compile your own scripts into standalone .xll addins.

Hope you find this helpful! ~Sancarn

Edit: This project is AI:X. All code written by Astra & Sol 6.2; albeit with a lot of steering.

11 Upvotes

29 comments sorted by

View all comments

Show parent comment

1

u/Double_Cost4865 1 10d ago

I don’t understand.

Take one compiled xll. Install numpy, pandas, and scipy (realistically, there’d be more, but let’s just go with these).

How big is xll, given that it includes it’s own runtime and dependencies?

1

u/sancarn 8 10d ago

The runtime is 17MB alone, the compressed project and dependencies is 60.5MB.

1

u/Double_Cost4865 1 10d ago

So together 78mb, what about uncompressed? That’s a lot. Imagine this in a large corporation, I work hundreds of workbooks on any given month.

2

u/sancarn 8 10d ago edited 10d ago

Same, but I wouldn't be compiling 100 separate packages for usage over my org? I'm not sure I understand your use case, and why the default xll-python doesn't suffice...?

What is more, if you have 10 separate python applications, and you launch them as 10 processes and they all import numpy/pandas etc. you have the same memory trade-off. The only way to prevent that is by having 1 global instance of python; but then you run into sandboxing issues. E.G. where 2 scripts can't define the same public module names etc.

Anyway, feel free to fork the repo and submit a PR if you think this needs changing.