ython for Excel (PFE) brings robustness to Python scripting for Excel and
provides a complete set of tools for building fully featured applications with
Excel front end. It is an in-process control of Excel with an out-of-process
development and debugging environment.
Python for Excel is an open source library distributed under MIT license.
Python for Excel mimics VBA in the manner of control of Excel application,
simplicity of programming style, syntax and naming of object model.
Functionality of an Excel workbook is controlled by a Python script placed in
the same directory. In the event of exception, a control window pops up with
an error message and a shell prompt. The user may choose to do post-mortem
debugging of the exception. The control window may also be requested during
normal execution by pressing a hot key combination. The control window runs
several concurrent Python shells. It does not block during script execution,
preserves namespace when closed and provides convenient access for
examination, experimentation and debugging.
All Excel events may be trapped. There is in-cell execution of Python
statements and two-way interfacing with VBA. The PFE's object model is
extensive. Every object has a hook for IDispatch-based manipulation from
Python shell and unrestricted C++ manipulation from extension library.
Python for Excel scripts are executed in-process with Excel. The PFE's object
model is based on in-process COM calls to Excel API. The programmer may assume
that third party applications and simultaneous user actions would not
interfere with script execution. The PFE script may release control of Excel
and regain such control later under set conditions.
Despite the fact that the PFE is based on COM technology it is a solution to
the "DLL hell" problem for all Excel based programming. The PFE installs once.
The functionality is controlled by Python scripts.
The binaries are compiled for 32 bit versions of Windows. The 64 bit Windows
is not supported because there is no detectable interest from the public.
Python for Excel runs the traditional Python, versions 2.5, 2.6 and 2.7 and
supports Offices 2000,2003,2007,2010. There is, however, one limitation
regarding third party's C++ extensions. For full compatibility use Python 2.5
with Excels 2000 and 2003 and use Pythons 2.5,2.6,2.7 with Excels 2007 and
2010. This limitation is only applicable to third party's C++ extensions. Pure
Python libraries and the Python for Excel itself function for versions
2.5,2.6,2.7 of Python and Offices 2000,2003,2007,2010 in all combinations. The
limitation exists because Microsoft introduced breaking changes into C++
runtime in 2005. One cannot safely load a C++ DLL dependent on later C++
runtime into an earlier version of Excel using the generic procedure inside of
Python's "import" directive. Such problem manifests itself as a DLL load
This is a "Beta" version of the product.
If the program does not install or you suspect that you have found a bug then
send an e-mail to "firstname.lastname@example.org". The author will assist free of
charge. The author provides commercial technical support for all other issues.
The book "Developer's Workshop to COM and ATL 3.0" by Andrew Troelsen was the
principal source of information on COM technology. The book "Excel 2002 VBA"
by Stephen Bullen, John Green, Rob Bovey and Robert Rosenberg was the source
on VBA for Excel. The book "wxPython in action" by Noel Rappin and Robin Dunn
was the source on wx library. The GUI is based on Scintilla editor at
http://www.scintilla.org and wx library at http://www.wxpython.org. The source
code of PyCrust by Patrick K. O'Brien was used as the source of research on
Scintilla editor. Fragments of PyCrust code were copied without changes. The
installation program is written using the Nullsoft Scriptable Install System