Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Tony

Pages: 1 [2] 3
News / Version 1.3.1 released
« on: January 15, 2012, 01:30:41 PM »

version 1.3.1 of PyXLL is now available to download from

If you've ever had any problems getting PyXLL to work with your specific version of Python I hope those problems will have been solved in this release. If you experience any problems at all please let me know.

New features:

- Developer mode Excel commands pyxll_reload and pyxll_rebind.
    PyXLL can now be made to reload all python modules or to update its Excel function bindings via these Excel macro commands. This works from outside Excel so it’s possible to do it from the command line or from an editor.

- Compatible with more versions of Python.
    There have been several internal changes to make sure PyXLL is compatible with any distribution of Python (now including PortablePython).

- Improved method for loading the Python dll.
    PyXLL will now look for a python dll in the same folder as itself before trying to load it from the system path. If it can’t find a suitable python dll it will now display an error dialog, whereas before Excel would simply report that it wasn't possible to load the addin.

- Config file may now contain multi-line pythonpaths and module lists

- New function get_type_converter for getting functions that convert between types PyXLL knows about (including custom types).

New examples:

- Eclipse and PyDev debugging example that shows how to attach the PyDev interactive debugger to PyXLL.

- Reloading example to show how to tell PyXLL to reload all modules or import/reload a module and rebind the Excel functions

Bug Fixes:

- XLCell type now works for cells past IV:65356 in Excel 2007 and 2010.

Many thanks to everyone who provided feedback and feature requests, and who helped with the beta testing of this release.

As always, please feel free to contact me with any feedback or problems.

Best regards,

News / Patch release 1.2.2 available
« on: September 04, 2011, 07:51:12 PM »
Version 1.2.2 is now available to download.

This is a patch release that fixes a problem passing arrays of floats using the float[] type that affects some versions of Excel 2007.


News / Patch release 1.2.1 available
« on: August 31, 2011, 07:43:15 AM »
Version 1.2.1 is now available via the downloads page.

This is a minor patch release that fixes an issue where Python bools returned as 'var' would be returned to Excel as integers.


News / Version 1.2 released
« on: May 02, 2011, 10:37:27 PM »

version 1.2 of PyXLL is now available to download from

The PyXLL website has been refreshed and I hope you will find the changes positive.

New features in PyXLL 1.2 include:

 - Asynchronous fuction support for Excel 2010
 - Unicode support for Excel 2007 and 2010
 - New xl_func kwarg to disable calculation in the function wizard
 - Callbacks to execute user code when PyXLL opens, closes and reloads
 - Config is readable by user code and supports variable substitution
 - Added more Excel macro functions, including xlcAlert, xlcCalculation and xlcCalculateNow

The examples have also been updated, most notably:

 - New example showing how to cache Python objects and pass them between Excel functions
 - A menu item example showing how to open the log file
 - Various callback examples

 As always, please feel free to contact me with any feedback or problems.

 Best regards,

News / pdf and html docs downloads
« on: November 07, 2010, 10:50:31 PM »

you may now download the PyXLL docs in html and pdf formats. Please see the links on the main documentation page,


News / Patch release 1.1.1 available
« on: November 04, 2010, 12:40:14 AM »

a new version, 1.1.1, is now available to download from

This is a bug-fix release to 1.1.0 and fixes a bug that some users were experiencing when using PyXLL with Excel 2010.


Help and Support / Excel 2010 support
« on: October 30, 2010, 04:00:50 PM »
I've received a few questions about PyXLL's support for Excel 2010.

PyXLL does work with Excel 2010 Professional 32-bit Edition. It has been tested with several of the beta versions, and with the final release 14.0.4760.1000 32-bit and there are no known problems.

64-bit builds are not currently supported however. If you have the 64-bit version of Excel 2010 installed PyXLL not currently work with it.

Home and Student and Home and Business Editions use the Microsoft Click-To-Run technology, and these versions have known problems XLL add-ins, including PyXLL.

If you are using either of the Home and Student or Home and Business Click-To-Run editions you need to uninstall Office 2010 and reinstall the MSI-based version as described here:

To check what version of Excel 2010 you have installed, go to the Help menu under the File menu in Excel.

Of course if you do experience any problems at all, please let me know.

** please check you are using version 1.1.1 of PyXLL for use with Excel 2010 **

News / Python 2.7 support added
« on: July 05, 2010, 10:16:24 PM »

version 1.1 is now available to download from

New features:
  • support for python 2.7 added

Bug fixes:
  • Minor GUI bug in the about dialog

Any questions, problems or comments, please let me know.


General Discussion / RTD Functions
« on: May 09, 2010, 03:38:04 PM »
** For an up to date copy of this code go to the pyxll-examples github repo **

** For Excel 2010 and later version you will need the exceltypes package **

I've been playing around a little bit with real time data (RTD) functions, and thought I'd post something here in case anyone else was interested.

Using win32com and Chris Nilsson's example (one of the win32com demos) it's pretty easy to get an RTD server working which you can then call from Excel with a formula like:


The only slight problems I have with this are:
  • the RTD function is not a very user friendly way to present a function to a user
  • registering the server requires access to the HKEY_CLASSES_ROOT, and most people shouldn't have that access

In VBA, it's possible to write a wrapper function around the RTD call to make it look like a normal worksheet function. Exactly the same thing is possible using PyXLL:

from pyxll import xl_func, GetActiveObject

@xl_func("int seconds: var")
def py_rtd_test(seconds):
    xl = win32com.client.Dispatch(GetActiveObject()).Application
    return xl.WorksheetFunction.RTD("Python.RTD.TimeServer", "", "seconds", str(seconds))

Now the user can enter a simpler formula and still get real time data back:


It's possible to register COM controls under HKEY_CURRENT_USER instead of HKEY_CLASSES_ROOT, it's just that win32com doesn't currently give you that choice. Luckily registering a COM control isn't actually that hard, you just have to know what values to put in the registry. Here's the function I used to register the server:

import win32con
import win32api
import pythoncom

def _register(cls):
    """register an inproc com server in hkey_current_user"""
    clsid_path = "Software\\Classes\\CLSID\\" + cls._reg_clsid_
    progid_path = "Software\\Classes\\" + cls._reg_progid_
    spec = cls.__module__ + "." + cls.__name__

    # register the class information
    win32api.RegSetValue(win32con.HKEY_CURRENT_USER, clsid_path, win32con.REG_SZ, cls._reg_desc_)
    win32api.RegSetValue(win32con.HKEY_CURRENT_USER, clsid_path + "\\ProgID", win32con.REG_SZ, cls._reg_progid_)
    win32api.RegSetValue(win32con.HKEY_CURRENT_USER, clsid_path + "\\PythonCOM", win32con.REG_SZ, spec)
    hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, clsid_path + "\\InprocServer32")
    win32api.RegSetValueEx(hkey, None, None, win32con.REG_SZ, pythoncom.__file__)
    win32api.RegSetValueEx(hkey, "ThreadingModel", None, win32con.REG_SZ, "Both")

    # and add the progid
    win32api.RegSetValue(win32con.HKEY_CURRENT_USER, progid_path, win32con.REG_SZ, cls._reg_desc_)
    win32api.RegSetValue(win32con.HKEY_CURRENT_USER, progid_path + "\\CLSID", win32con.REG_SZ, cls._reg_clsid_)

I added a call to _register(win32com.demos.excelRTDServer.TimeServer) to my module imported by PyXLL so the server would get registered whenever the addin was loaded.

I've attached a really simple example that registers the win32com demo server and exposes it via a worksheet function. If you try this you should note that the has the typelib version hardcoded to 1.4. To make it work with Excel 2003 I had to change EXCEL_TLB_MINOR to 5.


News / Version 1.0 released
« on: May 03, 2010, 10:00:34 PM »

version 1.0 of PyXLL is now available to download.

This version includes a few new features, but the biggest changes are internal to suport a new tool 'PyXLL-Bake' that allows you to create standalone redistributable Excel addins using PyXLL. If you're interested, drop me an email and I can give you more information about that.

The new features are:

  • a new type 'xl_cell' for passing metadata about the argument cell itself to python functions
  • pyxll stubs python module included to make it easier to test your code outside of Excel
  • xl_on_close decorator for registering on close callbacks
  • paths in the config file may be relative paths (relative to the config file)

The docs on the website have also been updated.

Please email me with any feedback or if you have any problems (or ask on the forum!)

Best regards,


News / PyXLL Forum is now online!
« on: March 26, 2010, 12:46:50 AM »
If you're reading this, you already know the PyXLL Users' Forum is now online!

News / 2010-03-15 - Version 0.6 released
« on: March 26, 2010, 12:46:08 AM »
Version 0.6 is now available to download.

This version incorporates the feedback I've gotten from the last couple of versions. It's very soon after 0.5, but I felt there were enough new features to warrant a new release.

Here's a list of the new features:

  • Selected Excel macro functions are now available to call from PyXLL. These are xlfGetDocument, xlfGetWorkspace, xlfGetWorkbook, xlfGetWindow, xlfWindows, xlfCaller. They all have the same signature as their C counterparts. If you're not sure what these functions are you probably don't need to. Full documentation will be added later.
  • Worksheet functions can now be registered as macro sheet equivalent functions using the keyword argument macro=True. Macro functions have access to the excel macro functions.
  • COM support is now built in. There's a new function GetActiveObject to get the Excel COM api corresponding to the Excel process that PyXLL is running in. This is different from calling win32com.client.GetActiveObject("Excel.Application") as that will return any of the running instances of Excel.
  • Volatile functions are now supported via the volatile keyword argument to xl_func. These functions are always recalculated regardless of whether their inputs have changed.
  • There's a new set of examples showing how you can call back from python to Excel from a menu callback and from a worksheet function.
  • A new user module called pyxll-startup is imported before anything else. By putting a file alongside the addin you can run some python code before anything else. This allows you to set the pythonpath to a non-standard location, for example.

News / 2010-03-07 - Version 0.5 released
« on: March 26, 2010, 12:44:09 AM »
Version 0.5 is now available to download.

The licensing of PyXLL has changed in this version. Now it is not necessary to obtain a license to use PyXLL for non-commercial or evaluation purposes. If you already have a licence key from a previous version it will continue to work with this version.

The dialog box that appeared when PyXLL was loaded no longer appears if you have a valid license key. If you are using PyXLL without a license or your license has expired you will still get a dialog that pops up. If you license expires you can now continue using PyXLL while you obtain a new license, but with the dialog box on load.

All bugs from the previous version that have been reported to me are fixed in this release. Of course if you come across any more, please do email me ( so I can look into them.

There are a few new features as well. Here's a list of them:

  • The var type may now be used to pass errors from Excel to python as python exception objects and vice-versa.
  • There's a new type float_nan that behaves like float, but if the cell is an error the float passed to your function will be NaN. This new type can be used in arrays and numpy arrays (e.g. numpy_array<float_nan>).
  • 1d numpy arrays can be used as argument and return types using the new types numpy_row and numpy_column.
  • A new decorator xl_license_notifier has been added. You can use this to get license information when PyXLL is added, for example if you want to send an email if a user's license is about to expire.
  • When developer_mode is set in the config file a new 'about' menu item is available under the PyXLL addin menu. It shows you the current version as well as any license information.

News / 2010-02-06 - Version 0.4 released
« on: March 26, 2010, 12:42:00 AM »
Version 0.4 is now available to download.

This new version includes a number of new features and a some bug fixes. Examples of all the new features are in the example files in the download package. Below is a summary of what's new.

  • Create custom menus via a new xl_menu decorator.
  • Reload PyXLL modules from a menu option, instead of having to unload and reload the addin. This new menu item is only avaiable if PyXLL:developer_mode is set to 1 in the config file.
  • NumPy array support for argument and return types.
  • Python isn't shutdown until you exit Excel, even if you un-load a PyXLL addin. This means PyXLL is doesn't conflict with other addins that also use Python (eg win32com).
  • Set the name of your addin in the config file (PyXLL:name) so it looks like any other addin instead of being called PyXLL.
  • Multi-threading support in Excel 2007 and 2010. Set the thread_safe keyword argument to the xl_func decorator to True to tell Excel it can call your function from another thread. In earlier versions of Excel it does nothing.
  • Allow win32com to be used inside a worksheet function or menu function to access the Excel object model. You can use this to do most things you might previously have done in VBA.

News / 2010-02-03 - London Python Financial Users Group meeting
« on: March 26, 2010, 12:38:39 AM »
Thanks to Didrik for organizing another LFPUG meeting.

For those who couldn't make it, you can download a copy of the PyXLL presentation here:

Pages: 1 [2] 3