Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
Microsoft Python

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.

This discussion has been archived. No new comments can be posted.

Microsoft Considers Adding Python As an Official Scripting Language in Excel

Comments Filter:
  • I just felt a great disturbance in the Net, as if millions of hackers were preparing to attack.

  • by olsmeister ( 1488789 ) on Friday December 15, 2017 @12:11PM (#55745819)
    I wonder how many more applications my boss can dream up for Excel that it really should never, ever have been used for?
    • 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)

        by Ubi_NL ( 313657 )

        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.

        • by networkBoy ( 774728 ) on Friday December 15, 2017 @12:36PM (#55745969) Journal

          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.

          • Changing editors can *totally* mess up the whitespace.

            If you don't know how to operate your editor.

          • 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

          • Name an editor that can't handle spaces. Simply follow PEP 8 [python.org] and your problems disappear. You would be amazed how many problems can be solved by gaining a basic level of competence before giving up.
            • Re: (Score:2, Offtopic)

              by plopez ( 54068 )

              Why? It's not a developer's job to become an editor guru but to code. Anything that interferes with that is wrong.

            • 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

              • 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.

                • > The idit is you.

                  *irony* Failed spell checking when name calling *facepalm*

                  • I belong to the lucky people that can read and comprehend stuff that has spelling errors.
                    Because I'm so super enhanced in my visual cortex, I simply don't see them :D

            • 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.

              • Your issue is with idiots, not Python. You should thank Python for making them easier to spot.
                • 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.

                  • You clearly didn't follow the link and read PEP 8. None of these are actually issues. You are the classic "OMFG ... It's easy to be stupid with language features. The language sucks!" fool. Every language allows idiots to be idiots.
            • 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.

          • by ceoyoyo ( 59147 )

            Use tabs. If some idiot (or their editor) puts spaces in the code, search and replace them with tabs. It's not a problem.

            • by plopez ( 54068 )

              why? it's not my job to clean up other's code. My job is to code.

            • by Yunzil ( 181064 )

              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.

          • by steveha ( 103154 )

            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

        • by Nkwe ( 604125 )

          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

        • by plopez ( 54068 )

          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

        • 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.

      • Big data analysis and AI like Python so adding it to Excel keeps Excel in the game....plus Excel is huge in quantitative analysis.

    • 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.

      • 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.

    • by hajile ( 2457040 )

      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)

    by Lab Rat Jason ( 2495638 ) on Friday December 15, 2017 @12:12PM (#55745831)

    ... that won't result in increasing the attack surface. (eye roll)

  • 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.

  • Just imagine the malware you could write in Python!
    • 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!

  • 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)

    by DogDude ( 805747 )
    It's a good idea. There's no reason (that I can think of) not to have more languages to use in Excel.
    • 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?

  • In principle, it might seem that supporting .NET languages would have made more sense; mainly when VBA is basically VB6 which is basically the old version of VB.NET. On the other hand, the .NET Framework already has a quite powerful communication with MS Office, so that alternative wouldn't have added too much to what is already available. I guess that I don't have a too strong opinion about all this, other than being quite curious mainly because of not being the typical Microsoft move.
    • by Anonymous Coward

      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

      • My experience is similar to yours. I have a very relevant .NET expertise, including dealing with MS Office communication, and have been in quite a few situations where I had to rely on VBA (e.g., the client wanted it for whatever reason, improving existing VBA codes which weren't planned to be migrated to .NET, etc.). Relying on .NET is much friendlier and logically I prefer it, but some times you cannot do what you want or what is best.
    • Re:Curious news (Score:4, Interesting)

      by Anonymous Coward on Friday December 15, 2017 @12:40PM (#55745987)

      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.

      • Python is a .NET language. Microsoft's IronPython compiles to .NET and uses the .NET framework instead of Python's regular packages.

        I meant the properly-speaking .NET languages (C# & VB.NET), simply because I don't have too much experience in the other ones and I am not sure about how well they support all the .NET features. In any case, it seems [wikipedia.org] that IronPython isn't a Microsoft implementation. External libraries allowing a given programming language to communicate with .NET are relatively common, but that fact doesn't convert the given language into a .NET one.

        And VB.NET is not really "a new version of VB6" at all

        Seriously? Then, how do you call the transition from the old VB to the

        • Re: (Score:3, Informative)

          by Anonymous Coward

          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

          • VB.Net is .Net first and VB second.

            I never said otherwise. Anecdotally, when writing VB.NET code, I always rely on pure .NET rather than on VB functionalities. My whole point was that, regardless of the evident differences between both of them, VB.NET is the evolution of VB (or VB the old version of VB.NET). You might even consider the whole .NET (and consequently also C#) an evolution of VB; exactly the same than VB was an evolution of Basic. This was my whole point.

        • As far as my post above got a quite unfair downvote and I know the kind of "knowledge"/"understanding" that some potential readers have, I will better clarify that I don't agree with either some statements said by that other AC or his/her approach to criticising/trying to impose certain position rather than properly understanding what I was saying. Also the other comments down this sub-thread (not sure if written by the same AC) do reflect a quite good knowledge about the .NET Framework, what is certainly n
          • A good example to illustrate my point right there. My "much less when not them or their context/applicability aren't properly understood." (rather than "much less when they or their context/applicability aren't properly understood") is a punctual, irrelevant error which doesn't tell too much about me (not even about my English skills or about how is my day today as opposed to any other day) and any sensible person should understand it as such.
  • by substance2003 ( 665358 ) on Friday December 15, 2017 @12:28PM (#55745919)
    So far it all seems to be very much against Python being used by Microsoft in Excel, granted it's still under 20 posts as I write this but considering it was the most voted feature on M$' site and I'm assuming those asking are themselves programmers, why so much negativity here?
    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.
    • 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.

      • 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

    • 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.
      • 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

    • by Gilgaron ( 575091 ) on Friday December 15, 2017 @02:10PM (#55746799)
      Sometimes I mock things up in Excel before handing it to a developer to code... being able to use Python in the mockup would be pretty awesome and give me more experience in a coding language that is actually widely applicable... seems like a win-win.
      • by AmiMoJo ( 196126 )

        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.

    • 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.

  • by mykepredko ( 40154 ) on Friday December 15, 2017 @12:30PM (#55745927) Homepage

    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?

    • Could anybody comment on why this is such a big issue?

      I think that the main reason is that people don't understand how powerful Office macros really are. They can do many things, not just in the spreadsheet but everywhere on the computer. They are basically a program. The chances of a VBA script or a random executable to do something wrong on your computer are pretty much identical; but people might consider the first option less problematic and treat spreadsheets with macros more carelessly.

    • 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.

  • Only one way to do anything.

    • 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.

  • by TuringTest ( 533084 ) on Friday December 15, 2017 @12:47PM (#55746059) Journal

    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)

    by Anonymous Coward

    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.

    • by swb ( 14022 )

      Gee, a wrong language, use this other one post on Slashdot. What a surprise.

  • It's a trap!

  • 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"

  • by Weaselmancer ( 533834 ) on Friday December 15, 2017 @02:35PM (#55746993)

    Office suite + Python = OpenOffice. This is already a thing. [openoffice.org]

    • Re: (Score:2, Informative)

      by Anonymous Coward

      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.

UNIX is many things to many people, but it's never been everything to anybody.

Working...