Hacker News new | ask | show | jobs
by s-phi-nl 4282 days ago
Can anyone compare this with PyXLL[1]? It does require add-ins, but xlwings requires a VBA module. From the instructions, importing the two seem about equally complicated.

I am more curious about technical differences than the difference in license (I know that PyXLL is closed source, while XLWings is F/OSS, BSD-licensed).

[1] https://www.pyxll.com/

2 comments

PyXLL embeds python, and so runs python in-process (that is, in the same process as Excel, without spawning a child process).

PyXLL fully supports UDFs (user defined functions) in a fast, efficient way. Calling a pyxll function (UDF written in python) calls into the in-process python interpreter and so there is no cost of starting up a new python process or calling into an out of process COM server.

Excel and Python types are converted to and from each other in optimized C code, depending on the argument and return types specified for the function (UDF). The type conversion is user extensible and so can handle automatically converting Excel ranges to and from pandas DataFrames (just one example).

The full Excel API is accessible from pyxll using the well known and established win32com package.

PyXLL works with Python 2 and 3, 32 bit and 64 bit (all versions from python 2.3 and 3.4).

PyXLL supports newer features of recent Excel releases like multi-threading and asynchronous functions, while maintaining compatibility with older versions.

PyXLL can expose python functions as Excel macros and menus as well as UDFs.

If you want to script Excel from a process outside of excel (eg IPython notebook) you can use win32com very easily without the need for any other package. But, if you want to have a python interpreter running inside Excel to be able to write performant UDFs as an alternative to writing VBA or C addins as far as I'm aware PyXLL is still the only package capable of doing that[1].

PyXLL has commercial support and is partnered with a major python training and consultancy company, Enthought[2].

[1]DataNitro claims to be able to do with, but according to their docs you are limited to only being able to run one Excel instance at a time, which for most real world users is too limiting in my experience.

[2]https://www.enthought.com/products/pyxll/

It doesn't really make much sense to compare xlwings with PyXLL, as they perform a slightly different function and actually could be used together.

PyXLL is more comparable to ExcelPython[1], which is open source does a similar thing (enables you to write UDFs in Python). ExcelPython hosts the Python process outside the Excel process but it

a) does not restart the Python process with every UDF therefore has good performance

b) does not require any registration of COM servers - therefore doesn't require admin rights

c) does not require an add-in (there is an add-in, but it just facilitates development, it's not actually required to use the resulting workbook).

[1] https://github.com/ericremoreynolds/excelpython