Live data from Hacker News

Use Python in Excel without add-ins

xlwings.org

21–30 of 73 posts

Re: Use Python in Excel without add-ins

#21

I know this doesn't support Linux and LibreOffice, but could it? Is there a technical way that would allow Python to sit alongside LibreOffice?

The documentation doesn't seem very mature, but Python is supposedly supported as a scripting/macro language, and it is also possible to interact with LO at the API level.

Re: Use Python in Excel without add-ins

#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"?

Re: Use Python in Excel without add-ins

#24
Very cool, just this week I was looking for something exactly like this to help automate reporting that absolutely has to be Excel. I wonder how well it plays with PivotTables and how it handles lots of data. I tried all the other python Excel libraries, and they either had memory errors with our data (It's not even that big, but it's much larger than we should be using Excel for), or were fine on memory, but would destroy PivotTables in the sheets they wrote.

For anyone running 64-bit Office and getting a compile error, to get it to run, just add the PtrSafe keyword to the Declare line like this,

    Private Declare PtrSafe Function [etc...]

Re: Use Python in Excel without add-ins

#25

Very cool, just this week I was looking for something exactly like this to help automate reporting that absolutely has to be Excel. I wonder how well it plays with PivotTables and how it handles lots of data. I tried all the other python Excel libraries, and they either had memory errors with our data (It's not even that big, but it's much larger than we should be using Excel for), or were fine on memory, but would d…

Or simply comment out that line: https://github.com/ZoomerAnalytics/xlwings/issues/72

Re: Use Python in Excel without add-ins

#26
post #3

I am guessing DataNitro isn't happy about this

Not at all, it's great to see more products helping people get away from VBA. xlwings is well-done and has some features we don't (e.g. Mac interop), and likewise we have some features they don't (e.g. UDF's).

(I'm one of the DataNitro founders.)

Re: Use Python in Excel without add-ins

#27
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?

Re: Use Python in Excel without add-ins

#28
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?

excel 2007 vba programmers reference

Re: Use Python in Excel without add-ins

#29
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?

If you are trying to automate some actions in the UI, use the record macro functionality and then edit the code. You can usually remove or combine a lot of the code it recorded.

If you want to use dictionaries/hashtable there is a reference you can add called scripting.dictionary.

When you search google for how to do stuff in VBA, most of the best answers are in Ozgrid and MrExcel sites, and of course StackOverflow.

Re: Use Python in Excel without add-ins

#30

So do you need excel to be installed to use this? Currently I use xlwt and read the files with google docs.

Yes...you need Excel installed (on Windows or Mac) as this is a package for interaction/programming with open files, not just reading/writing files.
Post reply on HN