Live data from Hacker News

Use Python in Excel without add-ins

xlwings.org

41–50 of 73 posts

Re: Use Python in Excel without add-ins

#41
post #8

Not sure if I see an actual use case for this since we live in a world that has Pandas, but I'm impressed.

with http://www.pyxll.com you can have functions that take and return pandas dataframes and series, see https://github.com/pyxll/pyxll-examples/blob/master/customty...

Re: Use Python in Excel without add-ins

#42
post #34

But couldn't you do this with win32com.client already?

Yes.

In the past, I've used Python to automate Excel, Outlook, and some non-MS products like Catia.

Honestly, I don't see the advantage here. FOSS is nice, and OSX support is nice, but if you're interacting with MS products, FOSS is not a concern anyway, and it's probably running on Windows...

What would be really nice is if it supported multiple backends, so I could run the same Python code with Excel, Apple's Numbers, Google spreadsheet or Gnumeric, and have it work the same on all of them.

Re: Use Python in Excel without add-ins

#44
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.

Might be irrevelant but anyone know best source to learn VB macros?

My favorite reference is the VBA Developer's Handbook by Getz & Gilbert from 2001.

You can probably learn everything you need from Googling for solutions to problems, but that book was great when I was committed to working with Excel and Access for a while. It covers a lot of things you're not going to think to search about.

Re: Use Python in Excel without add-ins

#45

To run a python function you do need to write one line of VBA code and you also need a vba file that comes with the package so although its not very much to add on the VBA side the title here seems a bit misleading.

From what I gather watching the video, you only need the xlwing.bas module and the supporting VBA code if you plan to invoke python from within the Excel file. If you're only manipulating an Excel file with Python externally, which was covered in the beginning of the video, it doesn't appear you need the module and VBA code.

Re: Use Python in Excel without add-ins

#46

http://pyxll.com/ already does all of this, better In particular it's in-process and does UDFs. Admittedly it isn't open-source but it is free for non-commercial use.

Except for the Windows only factor. Being able to code for all versions of Excel is useful.

Re: Use Python in Excel without add-ins

#47
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.

Might be irrevelant but anyone know best source to learn VB macros?

When I had to spend a large amount of intimate time with VBA I used to go to

http://www.cpearson.com/Excel/Topic.aspx

http://www.ozgrid.com/VBA/

Old websites but in my case I dealt with Office <= 2003

Re: Use Python in Excel without add-ins

#48
post #17

So this talks via IPC to Excel? How does it perform when working with huge data sets? Is the copying back and forth between the two processes a bigger bottleneck than the Python interpreter itself?

You can see this limitation in the video, when generating 100^2 random numbers takes a while.

Re: Use Python in Excel without add-ins

#49
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.

Might be irrevelant but anyone know best source to learn VB macros?

Years ago, I used Microsoft MSDN anytime I had questions relating to VBA.

Re: Use Python in Excel without add-ins

#50

Earlier quoted context omitted.

Might be irrevelant but anyone know best source to learn VB macros?

When I had to spend a large amount of intimate time with VBA I used to go to http://www.cpearson.com/Excel/Topic.aspx http://www.ozgrid.com/VBA/ Old websites but in my case I dealt with Office <= 2003

Great recommendations, these two sites are still the best today. Ozgrid is my go to forum, the community there is top notch.
Post reply on HN