r/excel • 8 • 23h 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.

10 Upvotes

14 comments sorted by

2

u/Successful_Safe_1440 16h ago

id like to learn more

1

u/sancarn 8 6h ago

Well if you have any questions feel free to ask ☺️

2

u/Fallingice2 12h ago • Bravo

Sounds like a security.risk

1

u/sancarn 8 10h ago edited 10h ago

Aha a lot like VBA 😜 I'm open to any PRs which improve that situation though. I think it'd be awesome to check areas of execution and describe to the user what access it gives. I think it'd be awesome if like deno/android it requested permissions ahead of time

2

u/Think-Excitement-851 35m ago

Why? Excel has a functional language

1

u/sancarn 8 26m ago

VBA? I love VBA, but VBA does has issues. Believe it or not, Python is one of the programming languages I hate most πŸ˜…, but I know this has been a desired feature for years, and I had an idea as to how it could be implemented. So, I gave it a go πŸ‘

1

u/bob_f332 1m ago

And python too, iirc.

4

u/Double_Cost4865 1 21h ago

I couldn't find any AI disclaimers. How much was AI involved in this?

0

u/sancarn 8 21h ago edited 20h ago

Yes AI:X. I added it to the github description. I'll add to this to the reddit post too πŸ‘

3

u/Double_Cost4865 1 20h ago

I haven't seen these tags before, but I like them.

0

u/sancarn 8 20h ago

Me too, always happy to be transparent!

5

u/Double_Cost4865 1 21h ago • Bravo

Sorry, you did say "this weekend", so this is all AI generated then.

1

u/decimalturn 32m ago

In terms of portability, how does it work? What's the minimal setup process someone has to do on their computer if I send them an .xlsm file that I created using user-defined functions with xll-python?

1

u/sancarn 8 29m ago edited 23m ago

Hi /u/decimalturn. If you've created some python scripts / udfs, you can use the on-board packager to package up your scripts with the python engine into a distributable XLL.

At that point, you simply send that XLL to your colleague and they can use it immediately after loading it into Excel.

Under the hood, it packages the python script with PythonExcelRuntime.xll, which has the Python runtime and Excel bindings, without the IDE and other UI of xll-python.