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
developement and debugging environment.
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 controled 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.
Python for Excel runs the tradditional 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 failure.
This is a "Beta" version of the product.
The Python for Excel is provided "as is", without warranty of any kind,
expressed or implied, including but not limited to the warranties of
merchantability, fitness for a particular purpose and noninfringement. In no
event shall the author be liable for any claim, damages
or other liability, whether in an action of contract, tort or otherwise,
arising from, out of or in connection with the Python for Excel or the use or other
dealings in the Python for Excel.
If the program does not install or you suspect that you have found a bug then
send an e-mail to "kaslanidi@yahoo.com". The author will assist free of charge.
The author provides commercial technical support for all other issues. To address possible
concerns about interruption of service the author is prepared to enter into a long term
contract with a clause that would force public release of the source code under the MIT license in
the event of service interruption.
Python for Excel is compiled using MS Visual C++ 2003 Toolkit and Express edition of
Visual Studio 2008. 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 at http://nsis.sourceforge.net/Main_Page.
The e-mail activated distribution program is based on Python, SMTP and MySQL.
History of changes.
09/15/2010. Initial version posted.
01/15/2011. Support for Pythons 2.6 and 2.7 was implemented. Installation utility
registers otsPythonForExcel.xla(m) for Offices 2000,2003,2007,2010 and adds PythonForExcel
directory to trusted locations for Offices 2007 and 2010.
03/22/2011. Previously cumbersome notation for in-cell evaluation of Python statements with string constant
has been corrected. Type =pfeEval(" 'exampleString' ") to get exampleString in-cell. Type
=pfeEval(" 'a\""b' ") to get a"b in-cell.
|