Lurker News
Folks, Microsoft is officially considering providing Python support in Excel (finally). If you are interested in this, please visit their uservoice page and let them know what you think. Thank you!

https://excel.uservoice.com/forums/304921-excel-for-windows-desktop-application/suggestions/10549005-python-as-an-excel-scripting-language

Comments (268) 74 threads

Earlier comments
75dvtwin#
1) performance, including multi-sheet setups, should be better than the current Macros.

For maintainability reasons, in one personal experience, I moved in-cell macros to VBA, and saw significant degradation in performance (my excel was calculating financial instrument attributes, based on raw input data (store in separate workbook with the same sheet)).
So my ask would be that Python-based scripting would not just be the same as VBA in speed, but faster than in-cell macros.
2) There needs to be easy-to-use capability, to be able create XLS files with the new language macros, from within other programs. So that the new Python modules can be written out together with data from within other programming languages (and MS-supported libraries to replace or augment something like openpyxl, and similar libs for other langauages will be much welcomed)
3) I think Python as a choice for Excel is a good idea. It should be a language with 'duck typing', and that has support for Data Frames, Reactive programming. And in that light, I would like to see that Python's Pandas are first class citizens in being able to address Excel cells, participate in graphing, pivoting, etc.
4) Version control within the excel file... may be this is going beyond the original ask... but I think the spirit of introducing Python into excel, is around better SDLC/reusability. And so local and remote version control models should be supported.
5) I personally do not care if other MS Office tools (eg MS word) support Python. Would be nice.. but for my needs, this is not relevant.
6) a type-checking mode to be able to say, this Module will type check the data it uses... at run time.

HumanDrivenDev3 replies#
An absolute no-brainer. Python is the new BASIC - very popular with people who have to program to do their work but aren't programmers. It's an excellent choice for a spreadsheet.
blhack6 replies#
>aren't programmers

Also extremely popular with people who are programmers and need to do things.
Sorry, this is a frustration of mine lately. Python is a fantastic introductory language. It's also a fantastic general purpose language.
Newbies get turned off of it because it feels too easy, and they know that "real" programming is supposed to be hard.

gregschlom19 replies#
I disagree.

Python is great for scripting and for small projects, but I believe strong, static typing is an essential feature for large scale projects. I wouldn't want to use Python for anything that's predicted to end up with more than a couple thousand lines of code.

pdpi#
Python 3 supports optional type annotations that you can check with something like flake8.
frgtpsswrdlame5 replies#
Most people writing VBA code for excel are only informal programmers. For example, I never took a CS course in my life but learned VBA and programming on the job. Since then I've learned python and other languages but when I'm doing a home project or something I always come back to python. It's just so easy. I was working on a macro the other day in Excel, it took me a couple hours to get it all working but I'm pretty confident that if I could've coded in python I could've banged it out in 20 minutes or less.

Edit: I suppose my point got a little lost. What I mean is that I highly doubt much Excel code is a "big project." It may feel that way when you crawl through some of the hideous VBA coding I've done but much of this is due to the inexperience of the coder and the realities of VBA. Give me python + 4 or 5 libraries and I could recode anything I've ever made in VBA in 1000 lines or less.

Continue this thread — 5 replies

Daishiman8 replies#
Given that there are literally thousands of huge projects using Python at massive scale and hundreds of kLOC, it's clearly not essential.

Continue this thread — 8 replies

xapata#
That's a fine personal opinion but I'll add my vote to Python being a wonderful choice for large programs.
Lxr18 replies#
Instagram would disagree with you. Seriously, Python is an absolute pleasure for managing large web projects and the lack of static typing has never been an issue for my company (spend the time writing tests instead!)

Continue this thread — 18 replies

caioariede3 replies#
Python is strongly typed, and Python 3 annotations with tools like MyPy brings static type checks.

Continue this thread — 3 replies

CraigJPerry#
I used to think that but I can't recall the last time the compiler saved me when augmenting or refactoring someone else's code - the IDE beats it to the punch every time - and static typing is not substitute for a good test suite.

On the flip side, i use interfaces and dependency injection constantly in java to work around static typing. In python, i write probably ~20% the amount of code because i never use interfaces, wiring logic or convert types.

deepnotderp1 reply#
Try Cython, the benefits of both, IMO.

Continue this thread — 1 reply

stestagg6 replies#
Last time I saw the Bank of America python codebase, it had ~6 million lines of code, was worked on by about 4,000 developers, and ran some core, performance critical functionality.

Python programming is an aesthetic that needs learning. Many of the worst written, and least maintainable python codebases I've seen are by programmers/teams coming from "proper" languages and don't think they have to learn how to write idiomatic python.

Continue this thread — 6 replies

bobwaycott#
Sitting on 90K lines of Python here. It’s a breeze. Rarely see an error, and when I do, it’s from a third-party API failing to do its job properly (which is then successfully caught to avoid it causing problems). I’m interested in and use other stacks (mostly Elixir), but I don’t have any complaints about the language itself after 10 years.
davepeck9 replies#
> strong, static typing is an essential feature for large scale projects

This is empirically false.
There are (of course!) good reasons to consider static typing. But, in my experience, use of static typing has never been a first-order predictor of business or technology success. It's quite possible to build considerable value with, for example, a large Python 2.x code base.
A fun, and tangentially related, talk: https://www.destroyallsoftware.com/talks/ideology

Continue this thread — 9 replies

crimsonalucard9 replies#
People will tell you that instagram uses python or yelp or other big name projects use python. Certainly, type checking is not Essential to a large project the same way utensils are not essential when you eat. You can just use your hands to shove all the food into your mouth.

Continue this thread — 9 replies

cm21873 replies#
I agree and I would add to that that many users of these scripting tools in Office are novice, and dynamic typing makes the language non self-discoverable. Static typing lets the IDE give a lot more feedback on invalid syntax, what can be done from there, etc. So I think this is a disservice we make them.

Continue this thread — 3 replies

jeremiep2 replies#
This is to script spreadsheets, not build the next Netflix.

I would hate a typed language in there. Besides most static typing systems are ridiculously weak and introduce more headaches than they actually solve.

Continue this thread — 2 replies

bogomipz2 replies#
>"Python is great for scripting and for small projects but ..."

You mean like Dropbox, Evernote, Ansible, OpenStack etc.

Continue this thread — 2 replies

ninjakeyboard#
Or at least a compiler to catch foot shooting (I used to agree 100% but elixir sort of changed my mind)
dragonwriter#
> but I believe strong, static typing is an essential feature for large scale projects

Python is strongly typed and has an available static typechecker, so, even if this is true, it doesn't rule out Python for this use case.

Walkman#
You should have a little bit more experience with Python and you would see how huge systems can be written in it with no problem. It needs a bit more discipline, but above 100k lines software written in any other language would need the same discipline also. (I'm working with 100kloc codebase right now and seen almost 300kloc. That was messy because mostly juniors wrote it :D but still bearable and profitable.)
cgb223#
I bet thats why so many AI, Backends, ML, and IoT projects are written in Python

because it has no long term potential

alexchantavy#
Yup, it teaches algorithms very effectively with low boilerplate; personally it's my favorite way of expressing dictionaries/hashtables and other data structures. Generators and iterators are super powerful concepts that I didn't learn in college and wish I did earlier.

It also allows a developer to manipulate individual bits, which is pretty amazing for security research or other cases when you want to get low level but don't want to get in the weeds with C.

sheetjs2 replies#
It's actually surprising the Excel team isn't considering TypeScript. TS is a modern language that they control, gives them an out for eventual browser compatibility, and they've already built great tooling (better than the visual studio tooling for python)
bpicolo#
> eventual browser compatibility

You'd be hardpressed to reinvent excel in a browser. Sheets is a big, advanced web app but it doesn't even come close.

Continue this thread — 1 more reply

Continue this thread — 3 more replies

Continue this thread — 2 more replies

andygreenwell#
Glad to hear that the Excel team is finally listening to your requests on this one. It's been a long time coming. Too bad they weren't interested during the TC days. If it does happen, it would be great if you could get the Cloud Numerics effort rebooted as well. There might still be a few people from our old team at NERD capable of resurrecting it.
erichurkman#
I would love this, but for a unique use case: we generate _a lot_ of workbooks using Python. Some of them have hundreds of thousands of automatically generated formulas. We also have to write tests for workbooks. If we could embed Python, which all of our developers know, into Excel, it would make testing our formulas a bliss, rather than the burden it is today.

Load more comments