PyXLL: Deploy Python to Excel Easily

PyXLL Solution Home | Buy PyXLL | Press Release

Today Enthought announced that it is now the worldwide distributor for PyXLL, and we’re excited to offer this key product for deploying Python models, algorithms and code to Excel. Technical teams can use the full power of Enthought Canopy, or another Python distro, and end-users can access the results in their familiar Excel environment. And it’s straightforward to set up and use.

Installing PyXLL from Enthought Canopy

PyXLL is available as a package subscription (with significant discounts for multiple users). Once you’ve purchased a subscription you can easily install it via Canopy’s Package Manager as shown in the screenshots below (note that at this time PyXLL is only available for Windows users). The rest of the configuration instructions are in the Quick Start portion of the documentation. PyXLL itself is a plug-in to Excel. When you start Excel, PyXLL loads into Excel and reads in Python modules that you have created for PyXLL. This makes PyXLL especially useful for organizations that want to manage their code centrally and deploy to multiple Excel users.

Enthought Canopy Package Manager   Install PyXLL from Enthought Canopy's Package Manager

Creating Excel Functions with PyXLL

To create a PyXLL Python Excel function, you use the @xl_func decorator to tell PyXLL the following function should be registered with Excel, what its argument types are, and optionally what its return type is. PyXLL also reads the function’s docstring and provides that in the Excel function description. As an example, I created a module and registered it with PyXLL via the PyXLLconfig file. In that module I put a simple function pyfib(): a naive Fibonacci implementation.

When I start Excel, I can access the Excel function wizard and find my pyfib() function and use it. The function documentation in Excel comes from my docstring. PyXLL parses the “n: integer input” portion as the variable documentation.

If I go back and make a change to the function, I can reload PyXLL without restarting Excel and update the cells. If I add another function to my module, it too will get loaded and be available to use in my worksheet.

So if you are developing Python models or functions for a large number of distributed Excel users, you can manage the code centrally. PyXLL will load new versions and new functions from the central repository whenever a user starts Excel. Deployment is very straightforward, and central management of all the code reduces the risk of Excel macros and functions proliferating uncontrolled.

I can also create menu functions using the decorator @xl_menu. PyXLL ships with several examples that you can start with. The one below adds a menu item to the Excel Add-in menu, and pops up a message box when selected.


13 thoughts on “PyXLL: Deploy Python to Excel Easily

    1. avatarCourtenay Godshall

      Hi Marcos – at this time PyXLL is only available on Windows due to its core integration with Microsoft Excel. Are you possibly on a Mac?

      1. avatarMarcos Carreira

        Yes, I am on a Mac , I had hopes that I would get some functionality with Excel, but it seems that it won’t happen.
        Thanks for the quick answer,

        1. avatarCourtenay Godshall

          Hi Phillip – unfortunately not in the near term, if that changes we’ll keep everyone posted.

  1. avatarBrian

    This is great, but a bummer that it is not planned for Mac. I hate using Python on a windows machine because I use the bash shell a lot when working on the Mac.

  2. avatarVincent

    I started learning Python because I cannot use EXCEL macro on a Mac. It does not make sense that PyXLL does not support Mac. Why would anyone want to do it on a PC where it is jammed with powerful VSBasic is beyond me….

    1. avatarBrett

      Vincent, there are a few reasons people use PyXLL on Windows over VBA:
      – productivity: Python is a clean, powerful language with a large analytic library ecosystem
      – performance: It’s straightforward to access C++, Cython code, and parallel processing from Python functions
      – management: instead of embedded VBA models, organizations can manage their Python code centrally and load it on start-up into each user’s Excel – no more uncontrolled version creep
      Sorry we don’t have it on Mac (for on this see below)

  3. avatarMagne Hillestad

    I am using Windows 7 and Windows Office 2010 and Python 3.3 64 bit. I have installed the pyxll on c:\pyxll. From excel/options /add-ins I have tried to install the pyxll.xll.

    The message is pyxll.xll is not a valid add-in.

  4. avatarBrett

    Re Mac (several):

    Sorry we don’t have PyXLL on the Mac. Enthought has taken this great, already-existing product for Windows, and given it much wider exposure by integrating it into Canopy and providing licensees with support.

    Why was PyXLL written for Windows only? First, that’s where the strongest demand is. Most Excel users, by far, are on Windows, and Python in Excel via PyXLL has distinct advantages over VBA, as we describe above (see Vincent’s comment). Second, while Python itself is cross-platform, Excel is not really. It uses a very different architecture on Mac than on Windows, so it is not simple to port PyXLL to Mac. It would be an extensive and expensive rewrite, and so far it is not obvious that there is enough demand to support such an effort financially.

    For Mac users who wish to take advantage of PyXLL, you can use it (as many of us at Enthought do), in a Windows Virtual Machine such as Fusion. Your single PyXLL and Canopy licenses are good on as many physical and virtual machines as you use.

    1. avatarBrian

      Ruin Mac OS with a virtual machine of Windows? Good solution there!!! Hate for Windows is why I am using Mac OS, I surely don’t want to use it.

      Most EXCEL users are on Windows for sure, but I doubt that most Python AND Excel users are on Windows, if know what I mean. Many people have Excel installed and don’t do much with it. Targeting that audience won’t help you much.

      When this comes out for Mac, it will do better than the Windows version.

  5. Pingback: PyXLL: Deploy Python to Excel Easily | Dev Stream

Leave a Reply

Your email address will not be published. Required fields are marked *

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 119,202 bad guys.