Microsoft Considers Adding Python As an Official Scripting Language in Excel (bleepingcomputer.com) 181
An anonymous reader writes: Microsoft is considering adding Python as one of the official Excel scripting languages, according to a topic on Excel's feedback hub opened last month. Since it was opened, the topic has become the most voted feature request, double the votes of the second-ranked proposition. "Let us do scripting with Python! Yay! Not only as an alternative to VBA, but also as an alternative to field functions (=SUM(A1:A2))," the feature request reads, as opened by one of Microsoft's users.
The OS maker responded yesterday by putting up a survey to gather more information and how users would like to use Python inside Excel. If approved, Excel users would be able to use Python scripts to interact with Excel documents, their data, and some of Excel's core functions, similar to how Excel currently supports VBA scripts. Python is one of the most versatile programming languages available today. It is also insanely popular with developers. It ranks second on the PYPL programming languages ranking, third in the RedMonk Programming Language Rankings, and fourth in the TIOBE index.
The OS maker responded yesterday by putting up a survey to gather more information and how users would like to use Python inside Excel. If approved, Excel users would be able to use Python scripts to interact with Excel documents, their data, and some of Excel's core functions, similar to how Excel currently supports VBA scripts. Python is one of the most versatile programming languages available today. It is also insanely popular with developers. It ranks second on the PYPL programming languages ranking, third in the RedMonk Programming Language Rankings, and fourth in the TIOBE index.
Obligatory (Score:2)
I just felt a great disturbance in the Net, as if millions of hackers were preparing to attack.
Re: (Score:2)
Be right back, I have to start a rumour that Microsoft is going to use Rust for something.
With Excel + Python, (Score:5, Insightful)
Re: (Score:3)
Probably not any more than what one could accomplish with VB and Excel. I really don't think that Python would be something that non-programmers would really embrace. Even as a software developer I struggle to see the purpose of using a language where white space is significant. That is about my only real gripe with the language, but it's the one reason I don't know it very well, because I find an alternative I'm much more comfortable with for just about every project.
Re: (Score:2, Insightful)
When I'd say "I struggle to see the purpose of using a language where a semicolon is significant" you'll scream and berate me for heracy. It's just another key. If you think the whole niche of python and its popularity is solely based on this one single feature you're ignorant.
Re:With Excel + Python, (Score:5, Interesting)
nah, semicolons are there no matter what.
Changing editors can *totally* mess up the whitespace.
Yes, literal spaces will help, but all it takes is one idiot/mistake and the codebase is pooched.
That and the fact that 2.x code can't run virtually unmodified on 3.x interpreters really pisses me off. Perl, for all its warts, just needs
use perl4;
at the top of the file right after the crunchbang and you're good to go with an old as dirt script on the newest interpreters.
Re: (Score:1)
Changing editors can *totally* mess up the whitespace.
If you don't know how to operate your editor.
Re: (Score:2)
Honestly, of all my gripes with Python, the whitespace is pretty low. You learn about it in the first day or so and move on. Same with the 2-to-3 thing. While you are learning, chances are you will only be dealing with one version. When you need to support both, it's not that hard - most of the critical libraries have been back-ported to 2, so you just try importing things and catching exceptions, and do a few imports from __future__. If you stay cognizant of 3-only features, it's really not much work to ke
Re: With Excel + Python, (Score:1)
Re: (Score:2, Offtopic)
Why? It's not a developer's job to become an editor guru but to code. Anything that interferes with that is wrong.
Re: With Excel + Python, (Score:2)
Re: (Score:2)
You don't get it. Tools should be easy to use so you can focus on what you need to do, Programming Motherfucker!
Re: With Excel + Python, (Score:2)
Re: (Score:2)
No. Just lazy in the right way. Now get to work playing with your tool.
Re: (Score:2)
Off topic? I was expressing an obvious point abut the toll assisting getting the job done instead of hindering it.
Re: (Score:2, Insightful)
You are _completely_ missing the point.
Form should NOT matter for function.
A compiler has one job -- translate code. It shouldn't matter if there is EXTRA (leading) whitespace for operations.
There are times where placing multiple operations on one line make the code MORE readable; so yeah, having a statement separator is a big deal. It isn't 1970 anymore where we have to place 1 operation on 1 line. Some of us have evolved to writing code two dimensionally WHERE it makes sense too.
Python, started off wit
Re: (Score:2)
The idit is you.
As obviously millions of programmers use Phython and like it.
Chances are: you are indenting your code the exact same why a Phython programmer does.
If that is the case, that makes you look even more retarded.
Re: (Score:2)
> The idit is you.
*irony* Failed spell checking when name calling *facepalm*
Re: (Score:2)
I belong to the lucky people that can read and comprehend stuff that has spelling errors. :D
Because I'm so super enhanced in my visual cortex, I simply don't see them
Static typeing and APIs (Score:2)
Look at a piece of code you wrote. 90% of the statements will be on one line.
So does it make more sense to use a character for new lines. Or one for continuations -- the 10% case.
But far more important is that VBA has static typing which Python does not. That becomes very important as programs become larger.
But far more important than that is that Microsoft have a new API for JavaScript (and I presume python) than the traditional COM/VBA one. And the new API is awful. But Micrsoft MBAs follow fashion,
Re: (Score:3)
VBA has static typing which Python does not.
(a) Python has strong typing, just dynamic rather than static. Most Python developers would tell you, and I would agree, that you should be testing your code with unit tests and assertions, and catching type errors at runtime is acceptable.
(b) Some Python developers, including the "Benevolent Dictator for Life" Guido van Rossum, feel that Python should have optional static typing, and it is now available. If you think it would help you, you can simply start usin
Re: (Score:2)
Sure, like VBA, Python checks types at runtime as well. But that is no replacement for static typing, which is the common case.
By relying on automated tests with 100% code coverage you are saying that Python is only suitable for professional developers. VBA is mainly used by people whose expertise is not programming.
It is really nice to know that once your code compiles, one large class of potential errors will be absent. And VBA could (but does not) be compiled to efficient code without relying on compl
Re: (Score:2)
you are saying that Python is only suitable for professional developers
Actually, I never said any such thing. IMHO Python is just plain an all-around easy to use language that's easy to understand. Every language has some weird stuff that you just have to get past to understand how it works; Python has less of it than any other language I've used. My nephew was able to write working Python programs at age 10... he didn't spend any time on "automated tests with 100% code coverage" and yet his programs wor
Re: (Score:2)
you're focusing on the issue without also acknowledging when I point out *why* it's still an issue:
all it takes is one idiot/mistake
If I'm taking in code from others and one of those patches is crap then poof.
As a result I have an extra layer of work (whitespace validation) for *all* contributors because some may be an idiot.
That's my issue with the whitespace.
Re: With Excel + Python, (Score:2)
Re: (Score:2)
why does the language add a fragility to the parser that is broken by something so easily?
And note that the opposite issue, a dev that contributes to multiple projects will find that they have to maintain different editor profiles to match the projects' needs. All it takes is errantly working on a project with the wrong settings in the editor and the same issue manifests.
In both cases the language has imposed a work penalty on the process of contributing code that can not be avoided. That is an issue.
Re: With Excel + Python, (Score:2)
Re: With Excel + Python, (Score:2)
HTML canâ(TM)t handle Python spaces. Lots of systems will parse out spaces/tabs and have some conversion.
Hence exchanging/saving code in Python is hard.
Re: With Excel + Python, (Score:2)
Re: (Score:3)
Use tabs. If some idiot (or their editor) puts spaces in the code, search and replace them with tabs. It's not a problem.
Re: (Score:2)
why? it's not my job to clean up other's code. My job is to code.
Re: (Score:2)
Use spaces. If some idiot (or their editor) puts tabs in the code, search and replace them with spaces. Then find the idiot that put in the tabs and have them shot. It's not a problem.
Re: (Score:2)
Changing editors can *totally* mess up the whitespace.
Not if you have been following Python's official standard (called PEP 8 [python.org]) and you have been using all spaces. I use vim, and vim has a setting to auto-expand tabs to spaces, plus I use the autoindent, so my code is always correctly indented and I never really need to think about it.
Also, with Python 3, it's no longer just a warning if someone sabotages your white space by inserting some tabs; it's an error. So if someone does somehow sabotage the code b
Re: (Score:3)
When I'd say "I struggle to see the purpose of using a language where a semicolon is significant" you'll scream and berate me for heracy. It's just another key. If you think the whole niche of python and its popularity is solely based on this one single feature you're ignorant.
Semicolons are a visible character and can be distinguished between other visible characters without regard to if the font used is fixed width or proportional. Spaces can't reliably be distinguished between other non visible characters (such as tab). Yes, spaces and tabs have a "visible" effect, but the characters themselves are not visible and how they are rendered on various display and print devices does not guarantee that you can visually determine the indent level (and consequently the scope or program
Re: (Score:2)
VBA does not use semicolons. It uses end of lines. Which is how people write code.
Re: (Score:2)
One of my gripes, other than the Fortran white space which was abandoned in F90, is the horrible way string handling done, though there are other things which are over convoluted. Reasonable languages consider regex a cross cutting concern. But in over objectioned languages it looks like:
>>> import re
>>> p = re.compile('[a-z]+')
>>> p.match("")
>>> print(p.match(""))
While in Perl it looks like:
$x="abcde"
$result=~/abc/;print $result;
Most programming languages know about cro
Re: (Score:2)
I think this is probably the reason Microsoft settled on VB in the first place. It's a far stretch from a perfect language, but it does have some nice qualities for managerial types such as no semicolons, case insensitive syntax, and white space isn't significant.
Re: (Score:2)
Big data analysis and AI like Python so adding it to Excel keeps Excel in the game....plus Excel is huge in quantitative analysis.
Re: (Score:2)
I wonder how many more applications my boss can dream up for Excel that it really should never, ever have been used for?
Ironically, Python can make many spreadsheets unnecessary in the first place. In my case, for 90% of the things that I would have done in Excel circa 1995, today I instead just whip up a plain Python script to compute. Usually the results go into a flat text table, sometimes I even have it spit out a chart in SVG format.
A script is typically much more readable and maintainable than a spreadsheet with a bunch of hidden formulas. It also fits better with version control systems.
Re: (Score:3)
Pandas with Numpy/Scipy has made it fairly simple to do a lot of things that I used to do in Excel, without the weirdness and performance limitations of Excel. Also, interactive charts... why doesn't Excel have these by now? Matlab figured it out like 20 years ago.
Re: (Score:2)
how?
Re: (Score:2)
Nothing for a very long time if they decide to go ahead. They introduced JavaScript as a VBA alternative in 2013. It's now 4 years later and while they've added a lot of APIs, there are still a ton left to go.
Splitting their API resources between Python and JS seems like the perfect way to get neither any time soon (and a great way to bike shed both out of existence altogether).
Yeah.... (Score:4, Funny)
... that won't result in increasing the attack surface. (eye roll)
Re: (Score:2)
Seems like being rid of VB script and replacing it with Python would be a security win.
Re: (Score:2)
Who said MS was getting rid of VB script?
When all you have is a hammer (Score:2)
I, for one, eagerly await reading about the new and exciting kind of WTFs that would result from this in The Daily WTF [thedailywtf.com] if this comes to pass.
Great idea! (Score:2)
Re: (Score:2)
just imagine the ability to connect multiple AIs with this!
One tensor flow connection per cell, cells referencing other cells.
No wonder Skynet tries to kill humanity, we grew it in Excel! It all makes sense now!
Good riddance to VBA (Score:2, Troll)
I heartily agreed with Edsger Dijkstra when he said "the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery."
The only reason why I've kept my VBA skills up is Excel - I find that I have to do a macro or two every three to six months and the process of getting my head around BASIC never seems to be simple and makes going back to C/C++/Python a chore.
Hopefully WebAssembly will help me get rid of that other programming abomination that I have to deal with - Javascrip
Good idea (Score:2, Insightful)
Re: (Score:3)
Is it a good thing to help idiots to build more powerful Office-powered clusterfucks? This is like building a cheap and reliable cell-phone-triggered detonator: In the most technical sense, you made an improvement, but what if you consider what they're used for?
Re: (Score:2)
Re: (Score:2)
Re: (Score:1)
Anybody who uses .Net isn't going to bother writing programs in Excel.
VS2017 is free, and includes VSTO. VSTO encourages using Excel files as data storage and not as scripting. Which is proper. Anyone who can use VSTO is going to write a separate program that consumes and emits data files, if that's a needed task, rather than embedding program and data into one binary clusterfuck.
But all that being said, people who "just want it to work" are still clueless normies that are going to abuse broken designs and
Re: (Score:2)
Re:Curious news (Score:4, Interesting)
Python is a .NET language. Microsoft's IronPython compiles to .NET and uses the .NET framework instead of Python's regular packages. And VB.NET is not really "a new version of VB6" at all - it's a whole different language that's more like C# with its syntax altered to visually resemble BASIC. It doesn't behave like VB at all.
Re: (Score:1)
Re: (Score:3, Informative)
VB.Net is .Net first and VB second.
For example, if you type If foo = "1234" Then, it's doing some wonky-ass classic VB shit in the background (implemented in the Microsoft.VisualBasic namespace syntax shims) to allow variable foo to be an Int32 and still compare without a type mismatch. If, in C#, you try the same thing with if(foo == "1234") and foo is an int/Int32, it's going to flip its shit at compile time. But best of all, in either language, you can do If foo.op_Equality("1234") Then (or if(foo.op_Equ
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Why is /. so negative? (Score:5, Insightful)
The way I see it, if Excel uses Python, it gives people more incentive to learn it and that can translate into people able to use it in other programs that use Python.
Also, as someone who's had to troubleshoot broken VBA scripts on Excel, anything that can move us away from them is a win in my book.
Re: (Score:2)
Totally agree with you - the only thing I might comment on the suggestion that rather than Python, .NET languages would make more sense.
VBA in Excel has always been horrible.
Re: (Score:2)
Totally agree with you - the only thing I might comment on the suggestion that rather than Python, .NET languages would make more sense.
VBA in Excel has always been horrible.
Well, there is Python for .NET (IronPython).
Other than that I agree with you and the OP. Excel is an excellent tool for what it is supposed to be used. That people use it as a database, that's a WTF, but that has nothing to do with the value of Excel and its automation.
It is the perfect tool for most what-if analysis needs. I've know plenty of people that added value to their work with VBA in the financial/insurance world.
Python is a much better choice for this, when you need complex mathematical fun
Re: (Score:1)
Re: (Score:2)
Bearing in mind the despicable behavior of MS throughout its history, can you blame people for airing negative views about this company whenever it is mentioned? MS is harvesting what it has sowed, and will carry on doing so for a long time.
When the idea is actually interesting and requested by developers. I think I can blame them.
If no one was requesting this feature and they added it, we might be wondering why they are even bothering but the fact is that there are people who are requesting this feature. Yes, they have a history of making their own versions of things but I'm sure they've also done good things and believe it or not, it's not everyone in the company that has bad intentions. I like to give them the benefit of the doubt on this
Re:Why is /. so negative? (Score:4, Interesting)
Re: (Score:2)
It would be great if we could have portable macros too. MS Office, Libre Office, Google Docs etc. all capable of opening and running the same macros.
Re: Why is /. so negative? (Score:2)
If you need scripting in your spreadsheet youâ(TM)re better off using plain Python or R. Doing an ANOVA in 32000 rows and 20000 columns on Excel is wrong and makes people that support those people cry.
How much Malware is distributed via Excel? (Score:3)
Interesting all the comments regarding malware being distributed by Excel. Doing a quick search, the amount of malware distributed by Excel is on the rise.
I guess it comes from downloading pre-made spreadsheets - something I guess I'm immune to because other than an expense spreadsheet mandated by an employer, I don't think I've ever taken a spreadsheet where I didn't know it's creator personally. In terms of adding macros from other sources, the one or two times I've done that they've ended up being more work to get functioning properly than writing them on my own.
Could anybody comment on why this is such a big issue?
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Interesting all the comments regarding malware being distributed by Excel. Doing a quick search, the amount of malware distributed by Excel is on the rise.
Could anybody comment on why this is such a big issue?
It's really anything Microsoft as it's so distributed, more bang for your buck.
Microsoft just doesn't get it, Word default "was" macros allowed, and the list extensive in this respect.
I like the philosophy of Python (Score:1)
Only one way to do anything.
Not true... (Score:3)
Only one way to do anything.
Except that isn't true... for example you can format a string in several different ways. And then there is the different ways between 2 and 3.
Perl's simple string interpolation is much easier and straightforward.
The ultimate debugger (for non-devs) (Score:5, Interesting)
To all those predicting doom and gloom: Excel doesn't fit the role of an IDE, it fits the role of the debugger. Sometimes, much better than a debugger integrated in the IDE.
For those who know what we are doing, a spreadsheet is a wonderful tool for rapid prototyping business processes and gathering input from domain experts at the initial phase, when requirements are not at all clear and change quickly.
Having a modern language friendly to exploration and prototyping would be a welcome addition.
Wrong Language (Score:2, Interesting)
Lua is more user friendly. It has less features, dynamic typing, starts at 1, doesn't care about whitespace, and was designed to be embedded within other things*. All those things are good qualities for people newish to programming.
*Which'll improve its security compared to Python. You can easily remove function/modules from the language and you can isolate parts of a script from each other. It's trivial to load a new module and prevent it from accessing the I/O system.
Re: (Score:2)
Gee, a wrong language, use this other one post on Slashdot. What a surprise.
It's a trap! (Score:2)
It's a trap!
Interesting but scary from a sysadmin perspective (Score:2)
I do a lot of end user computing work, and that includes supporting some of the "applications" written in Excel and Access that have somehow managed to insert themselves into the flow of millions of dollars. Adding another language, especially a more open-ended one like Python is going to be an interesting backwards-compatibility exercise.
The major problems we see with Office migrations are:
- Add-ins, usually written by a long-gone consulting company and critical to some business process
- VBA "applications"
Um...OpenOffice anyone? (Score:5, Informative)
Office suite + Python = OpenOffice. This is already a thing. [openoffice.org]
Re: (Score:2, Informative)
Ninja'd! I just checked and LibreOffice also supports Python for scripting (https://help.libreoffice.org/Common/Scripting). As would be expected since Open/LibreOffice are essentially the same thing. Has been true for a long time, so Excel (just that, or is it possible in all Office components as in L/Ooffice?) is really just catching up here. Scripting can be done in Basic (equivalent but not identical to VBA), Javascript, Beanshell, and Python.
Re:Python in Excel... (Score:5, Insightful)
My gut reaction is YES YES YES because I'm often stuck in Excel for... reasons... and don't like VBA much despite being pretty good at it.
But like you said, it probably won't be Python - it will likely be MS Python, stuck at some version forever and probably without nicey-nice stuff like the scientific libraries and package management that make it so useful.
Re: (Score:2)
Even the old versions of Python are pleasant to work with. In some ways, more so than more recent versions. I remember when decorators were introduced and meta-programming became all the rage. While I could appreciate their purpose, I was not thrilled about the increased complexity. That said, these features are optional.
Re: (Score:2)
It's not the Python version, it's the libraries. Freeze, say, Numpy or Scipy at their current version for 10 years. New libraries are unavailable... it largely loses it's appeal. Like Perl without CPAN.
Re: (Score:2)
Well, first thing is that it will probably be IronPython, so have fun even getting that stuff installed in the first place.
Not that I'm too thrilled about this anyway. People already use Excel to do things that it really shouldn't be used for. Adding Python to the mix isn't going to help this any.
Re: (Score:2)
Adding Python to the mix isn't going to help this any.
Ahh, but it will help those of us who are stuck using Excel to do things that it really shouldn't be used for :)
Re: (Score:2)
Uh...not, it will be vanilla python. Microsoft doesn't do that shit anymore.
Re: (Score:2)
Without package management and the critical scientific libraries (Pandas, Scipy/Numpy, etc.), it is not "vanilla" Python in any meaningful way. I suppose these libraries could all be saved with the file or they could add some kind of dependency management to Excel - but honestly, it just does not seem like we'll get a great result here. Hope you are right.
Re: (Score:2)
So, you are making shit up and then criticizing them for your made up shit?
Re: (Score:2)
Correct. I'm making up shit based on their past history. You should try it sometime, it's a very nice skill to have. George Bush even laid out the logic very eloquently once upon a time.
Obligatory Archer (Score:1)
Do you want to make insecure software? Because that's how you make insecure software.
Re: (Score:2)
Yes, as a matter of fact, I want to make insecure software. I can do this today in VBA, and it is quite useful. Opening and writing arbitrary files on the system and network is super-useful and I don't see why they would change that just because they add Python as a scripting language.
Re: (Score:2)
I never said Python would make things worst. All I said was that allowing such things is a terrible idea, whatever the language is.
Re: (Score:2)
OK, but it already exists, and making insecure software is highly useful. It's not like my data crunching script will be public-facing, and I most certainly don't want to jump through hoops to read and write arbitrary data. In any event, my bare Python scripts are less secure than my VBA running in Excel. If someone double-clicks a python script (or compiled exe), it will execute arbitrary code whereas Excel will make you click a box to execute a VBA macro.
Re: (Score:2)
wtf? scripting your data analysis in a spreadsheet makes insecure software?
Re: Obligatory Archer (Score:3)
Exactly. Why anyone would use computer software for automation is beyond me.
Comment removed (Score:5, Informative)
Re: (Score:1)
This right here.
And for that extra little bit of help in finding out how to "do it the right way", here's a wikipedia article that links to the correct toolset. From here, you can google the details.
Visual Studio Tools for Office [wikipedia.org]