Live data from Hacker News

Use Python in Excel without add-ins

xlwings.org

61–70 of 73 posts

Re: Use Python in Excel without add-ins

#62
post #22

I use it since today, and I'm very impressed. I work for a financial startups, with old fashioned non-tech guys who works only on excel. Xlwings sove me from VBA programmation for my algorithms ...

This may not be an issue where you work, but how do you get away from those who "want to see the formulas" and "want to be able to modify the spreadsheets"?

Python is very readable; those users can usually understand it if they try.

Re: Use Python in Excel without add-ins

#63
post #40
post #6

This is fantastic - I am going to start testing it now. I write a fair amount of VB macros, and would much prefer to be able to use Python. And, if they could create a plugin that allowed Libre Office to do the same, they could solve one of the last remaining major interoperability issues with LO and Excel: the inability to run VB macros in LO. That would be huge.

LibreOffice has python support http://api.libreoffice.org/examples/examples.html

The Python API looks horrible, basically Java code with Python syntax.

Re: Use Python in Excel without add-ins

#64
post #59
post #56

I was looking for the 'secret' sauce used to get python being able to interact with Excel: http://showmedo.com/videotutorials/video?name=2190010&fromSe... However, I still haven't looked how the reverse is done (by xlwings.bas in Excel). Is it that XLWings also implments a COM server from which VBA can run Python?

The source is on GitHub... https://github.com/ZoomerAnalytics/xlwings The magic you're looking for is here: https://github.com/ZoomerAnalytics/xlwings/blob/master/xlwin... Surprisingly simple actually.

I was expecting something a bit more complicated, but simplicity usually is the best way to go...

Re: Use Python in Excel without add-ins

#65

How does the automation of Excel work on the Mac since there is no COM on mac? Is there some Applescript alternative ?

Office apps on the Mac are automated using Scripting Bridge [1]. Applescript is one way to drive a scriptable app, but Python and other languages can also use the bridge. I built a substantial Word addin on the Mac in C# on Mono, using the Scripting Bridge.

[1] https://developer.apple.com/library/mac/documentation/Cocoa/...

Re: Use Python in Excel without add-ins

#66
post #63
post #40

Earlier quoted context omitted.

LibreOffice has python support http://api.libreoffice.org/examples/examples.html

The Python API looks horrible, basically Java code with Python syntax.

That was my impression as well, the last time I looked. Surely it can't be all that difficult to resolve?

It's a shame, having a simple python scripting system built into Calc would be a major advantage.

Re: Use Python in Excel without add-ins

#67
Very nice although the real pain of programming against Office APIs isn't the language but the Office object models themselves, which seem to have been invented in hell by multiple demons that weren't communicating with each other.

Re: Use Python in Excel without add-ins

#69

Earlier quoted context omitted.

No but have a look at https://github.com/ericremoreynolds/excelpython for UDFs.

Cool. The problem with all these big "VBA replacements" (and don't get me wrong, I've done both VBA and VSTO and the latter is more pleasant to work with) is that they never seem to provide replacements for UDFs, which is probably the #1 reason you'd want to use VBA in the first place.

Excel-DNA is a nice open source project that lets you write XLLs in .NET http://exceldna.codeplex.com

Re: Use Python in Excel without add-ins

#70
I recently compared various ways to automate Excel with python: http://leontius.net/2014/excel-data-analysis-python/

Xlwings is something I did not know before writing the post, but it does look great and I would love to try it as soon as possible. It basically has all the advantages of Datanitro but it is free.

Post reply on HN