The new CreatePyModule() function introduced in xlSlim 2.0.10 makes it easy to register Excel functions from Python code directly in an Excel workbook.
This makes it simple to copy and use code written by ChatGPT. We can ask ChatGPT to write a function:
And then copy and paste the code into an Excel cell. Once the code is in a cell we can use the CreatePyModule() function to create a dynamic Python module and register the Python functions as Excel functions. Here we see a ChatGPT-generated mortgage repayment function working in Excel:
As long as ChatGPT can write the Python functions (ask it to use type hints!) we can use the functions within Excel.