Live data from Hacker News

My thoughts on Python in Excel

xlwings.org

51–60 of 123 posts

Re: My thoughts on Python in Excel

#51

Didn't read it but, couldn't this be a "battlefield" where LibreOffice could have unbeatable advantage?

What's the state of things at Libre office regards to this? Do they support python or other languages for macros and for formula/expressions?

yes python supppoted in libraoffice

Re: My thoughts on Python in Excel

#53
Maybe its time to start fresh with a clean sheet? (Pun).

The spreadsheet paradigm is immensely intuitive and arguably the only alternative to the standard procedural programming currently in use in number crumching.

But therein lies also a major weakness when used for important tasks: hard to validate.

Once you further combine it with API calls and whatnot, the situation gets totally out of hand: how do you reproduce anything?

The landscape around user interfaces, computational capability and (most importantly) the ever deeper embedding of such tools in decision making suggests to start taking the humble spreadsheet seriously and maybe that requires going back to the drawing board.

Re: My thoughts on Python in Excel

#54
post #11

The big problem is that this is exactly backwards. I rarely want to access Python from my Excel. I quite often want to access Excel from my Python. A spreadsheet is a great GUI for a lot of things. A lot of people are employed creating "shitty version of Excel but can be driven from any of " Being able to easily drive Excel from an external Python program would make for a nice cross-platform application substrate.

XLWings – the product made by the author of this post – lets you do exactly that. You can make a Python script that connects to a live Microsoft Excel process, iterates over sheets and cells, reads/writes data to them, etc.

I’ve used it at work some years ago, and it’s a great product.

Re: My thoughts on Python in Excel

#55
post #11

The big problem is that this is exactly backwards. I rarely want to access Python from my Excel. I quite often want to access Excel from my Python. A spreadsheet is a great GUI for a lot of things. A lot of people are employed creating "shitty version of Excel but can be driven from any of " Being able to easily drive Excel from an external Python program would make for a nice cross-platform application substrate.

That's one of the most important goals in my particular "shitty version of Excel", https://github.com/ironcalc/IronCalc

:)

Re: My thoughts on Python in Excel

#56
post #50
post #31

Earlier quoted context omitted.

Most Excel users (not the power users, just the 1.1 billion everyday ones, including many of the enterprise ones) don't know how to program in any language. You're coming at this with a HN mindset. "Python vs Lua" is not even on their radar. And even if it was, their criteria would be dominated by platform lockin and compatibility with other licenses (e.g. commercial SQL, Tableau, MSFT, etc.). Not by "which open-sour…

IMO you're the one coming in with an HN mindset. Python has massive mindshare even among people who have never programmed. It is the numeric computing language du jour. In any given financial company there are definitely already python users. Lua, a language primarily known for plugin scripting, with no numeric computing libraries, that has zero mindshare among non career programmers, is not even in the conversation.

Nobody here has made a case for Lua in Excel. I wrote "Python vs Lua" is not even on the radar of most Excel users, not even the subset that are programmers.

(Why are people here aggressively misreading everything I type, today?)

> Python... is the numeric computing language du jour. In any given financial company there are definitely already python users.

The original post didn't say "financial Excel users". Not all Excel users are financial; most aren't. I've worked with legal informatics users, e-commerce users, bioinformatic users, among others. Those sectors never use Excel for numeric computing, IME (drawing the occasional chart isn't numeric computing). They are more familiar with SQL, SQL macros, SQL query generators, importing/exporting to/from SaaS, etc. Like I said.

Re: My thoughts on Python in Excel

#57
post #2

Without interacting with it myself, none of this is surprising. I have used excel in the past, and I am a long term python user. But if you asked me today what I really wanted to make my life easier and ultimately a product or business better using only excel? I would ask for lua or scheme. I don’t need a batteries included environment embedded into a spreadsheet. I just want sane syntax for common functionality whic…

The likely target users for this are analyst/ quant types. Very likely they are also using Python on the same tasks already.

Re: My thoughts on Python in Excel

#58

Didn't read it but, couldn't this be a "battlefield" where LibreOffice could have unbeatable advantage?

What's the state of things at Libre office regards to this? Do they support python or other languages for macros and for formula/expressions?

There's a Python wrapper for the Java API. Documentation is scarce. Also Libreoffice only supports any of the nice and new Excel functionality .... since last month: https://bugs.documentfoundation.org/show_bug.cgi?id=126573

Re: My thoughts on Python in Excel

#59
I was quite excited when I heard Python was coming to Excel but the execution pretty much guarantees that adoption is going to be horrible. If I as MSFT wanted to get people to write Python scripts that can take advantage of Excel's great abilities this is probably the worst way I could have gone about it. A ham-fisted, cloud-first feature implementation that is basically jammed into the product without appropriate contextual abstractions is a pretty poor way to get things done. Given that Excel itself has a strong tabular object model built in, why would a DataFrame be required as a separate construct?

> We wanted an alternative to VBA, but got an alternative to the Excel formula language

Optimistically, I would guess that the powers that be inside MSFT wanted to show they "integrated" Python into Excel but didn't really want to mess too much with a product that has stabilized over the past 30 years. Cynically, I would say that they've messed up the implementation on purpose so they can put a bullet through the "Python in Excel" idea without actually doing anything useful.

A much better way to add Python (or any modern scripting language really) to Excel is to 1. Make a special library that can be called from the language and which only works with Excel. 2. Bundle a minimal interpreter so that the scripts can be run locally without pushing everything to some godforsaken Azure datacenter. Make this a downloadable plugin for all currently supported versions to ensure backwards-compatibility.

This is a much better way to ensure that Python becomes the glue language for Excel. There are so many applications where reporting, analysis and visualization can be better achieved through automation using scripting languages. VBA is old, limited and is yet another thing for someone to learn if they want to script any Office product. All of these are hurdles that can be easily removed. I guess though that the part that really sucks is that these are all things that the MSFT of the 80s/early 90s would have done in a heart beat if it meant more people would use Excel (they built in bugs from Lotus 1-2-3 for God's sake) but I guess it's a different story today when everybody does use Excel.

Re: My thoughts on Python in Excel

#60

Didn't read it but, couldn't this be a "battlefield" where LibreOffice could have unbeatable advantage?

Python on LibreOffice appears to be more concerned with moving GUI elements and not enough with manipulating cells. There doesn't appear to be a straightforward library/module which helps me access specific cells and get their values. This would be a greater value proposition than allowing me to control Calc as a puppet using a Python script which seems to be their main idea.
Post reply on HN