back to article Python in Excel goes live – but only for certain Windows users

Office power users, rejoice: Python in Excel is now generally available - provided you have the right license and machine.  First teased last year, the new feature allows Excel users to run Python scripts inside workbooks for analytics and other purposes. Redmond announced the official release of Python in Excel for Windows …

  1. xyz Silver badge

    Phew...

    Dodged a bullet there.

  2. Richard 12 Silver badge

    I guess this is to deprecate and remove VBA.

    So on the one hand we get to swap one massive security hole for another one, while on the other Microsoft gets to reduce their workload while charging more.

    On the gripping hand, it also means LibreOffice can now legally implement the same scripting language.

    1. Charlie Clark Silver badge

      The move is an attempt to stay relevant as more and more people do stuff they used to do in Excel with tools like Pandas.

      The Python code gets run on Azure machines.

      1. CowHorseFrog Silver badge

        Python is well known for its native code too help its speed problems, whats the bet this will help introduce a new wave of problems..

        1. Charlie Clark Silver badge
          Stop

          The whole thing is designed to run computationally expensive tasks on Azure. Millions are people are already using Python tools for sophisticated data analysis.

          1. CowHorseFrog Silver badge

            Microsoft and designed ?

            Just like ActiveX controls were designed and secure ?

      2. karlkarl Silver badge

        > The move is an attempt to stay relevant as more and more people do stuff they used to do in Excel with tools like Pandas.

        Not really. They just couldn't successfully port msvbvm60 to the web via emscripten. Even on Windows, I don't think they ever managed to make it 64-bit clean.

    2. katrinab Silver badge
      Meh

      OfficeScript is the thing that is to deprecate and remove VBA.

      There is nothing here that you can't do in pure Excel formulae. In theory anyway. It is pretty easy to bring the entire system to its knees if you use all 1048576 rows, whereas if you pull it into Numpy do your work there and spit out the results, it will likely work just fine.

      Also there's some charting options that aren't easily available on Excel.

      1. CowHorseFrog Silver badge

        You cant change how cell inputs are validated ....

        Excel is still today confusing DNA sequences with dates etc.

  3. beardman
    Devil

    Execl and some scripting language... No, does not ring a bell...

    1. Anonymous Coward
      Anonymous Coward

      Funnily enough, yesterday I couldn't track down a problem in a very large excel spreadsheet which was supposed to be processing several sets of loading data for a finite element model (each set of data had over 0.5 million items.) In the end, I gave up and processed the data in a python script instead..... (probably what I should have done to start off with, but when you're given data in excel, it's easy to temporarily forget there are other options....)

      1. werdsmith Silver badge

        The scourge of 2nd line application support desks.

        Somebody (non technical - not a developer) creates a rats nest of a crosslinked workbook using lots of googling to figure stuff out Only they use it and know it. They leave the business and a person inherits their role - and the Excel Workbook. Then something needs tweaking to accommodate a change, and the new person fiddles with part of the chain and breaks the whole thing. Department boss demands that support fix it quickly. Look forward to hearing about this when Excel transitions.

  4. Pascal Monett Silver badge

    run Python scripts inside workbooks

    Yay ! A whole new playground for mischief-makers is now available !

    I can't wait to find out how miscreants will be able to subvert this.

    1. Dan 55 Silver badge
      Trollface

      Re: run Python scripts inside workbooks

      In the same way they subvert any Python script... by writing for a different version of Python than the one you have installed and sending you into Python dependency hell.

      1. Charlie Clark Silver badge

        Re: run Python scripts inside workbooks

        I'm trying to think of specific examples as Python is notoriously cautious at introducing new syntax and has a pretty good track record of backward compatibility, some unnecessary errors in the move from Python 2 to Python 3 aside. Changes in the last decade or so: async and match; the walrus operator and the type hints noise. Code from 2.7 should run largely unchanged on Python 3.12 and the forthcoming 3.13. I run CI for a couple of projects for a wide range of versions and syntax changes are rarely a problem for existing code. It's usually good practice to avoid the new stuff in production for a couple of releases: async is still ironing out the creases, and while the match stuff could be very useful in some use cases, it's still quite slow.

        However, I'm not a huge fan of the change to yearly releases and the relatively quick deprecation of older versions, which are likely to be running on millions of machines around the world. But I think this is the case for other languages where too many people seem to have forgotten sys admin wisdom of leaving things running wherever possible.

        1. mpi

          Re: run Python scripts inside workbooks

          > and has a pretty good track record of backward compatibility

          Python has a pretty good track record, true.

          Python packages are a very, veeery different matter.

          The amount of time I wasted fixing old, or even abandoned, python packages, where the maintainer thought it would be a swell idea to pin one specific version of a dependency as a requirement, even though nothing in the package actually relies on that specific version of that dependency.

          And those are still the easiest to fix, usually I just need to update an old pyproject.toml or setup.py to make pip stop complaining.

          It gets alot worse, when suddenly a package relies on some C-libraries, and there actually is a reason that dependency was pinned, so I have to install an old version of the package, which requires an old version of the lib to work, but the system no longer has that lib, because its 10000 years old...

          1. Charlie Clark Silver badge

            Re: run Python scripts inside workbooks

            Oh yeah: pinheads! The version pinning stuff can be very annoying: pinning really should be limited to deployment unless there are breaking changes to consider, in which case >= and occasionally <= are you friend. Had one guy submit a heap of PRs, including pinning and complete refactoring of tests away from the code… and nothing else of substance.

            Packages needlessly dropping support for older Python versions is also very annoying.

        2. Grogan Silver badge

          Re: run Python scripts inside workbooks

          Python 3.7 to python 3.8... removal of nullptr broke a lot of shit. That's one example that came to mind (because it affected applications I needed to use... had to build LibreOffice with its own python interpreter)

          Also, regardless of compatibility, any x.x.y upgrade is going to break all your modules anyway.

      2. katrinab Silver badge
        Unhappy

        Re: run Python scripts inside workbooks

        There is no pip install x

        There is also no requests, httpx, pandas.read_excel or anything like that.

    2. Charlie Clark Silver badge

      Re: run Python scripts inside workbooks

      Not really, for years there have been successful examples of safe Python sandboxes running "untrusted" code. But the runtime is key and the VBA runtime always had too many privileges, as well as being very slow. I've not looked deeply into the details, but in the request to add support for the feature to my library, from a Microsoft employee incidentally, was all running code on Azure.

  5. Gerhard den Hollander

    so much , so much

    So, embedding a scripting language inside an excel file that can get emailed to you

    Trying to rerun last years close-fiscal-year excell sheet, only to end up in pip-hell

    excel wizards trying to outsmart themselves by writing extremely clever python scripts that drag in excel sheets that use python scripts

    People who don't understand python seeking help from python developers who dont understand excel

    O(N^3) python code that works awesomely for 20 line 50 row spreadhseets being applied to 5000 line 200 row spread sheets

    And probably the clincher, excel wizards starting to migrate VBA excel files to python files and stopping part way so you know have an excel/VBA/python monstrosity

    i think this is a really clever ploy from M$ who will soon be announcing an Excel consultancy business ....

  6. Plest Silver badge
    Pirate

    Superb idea and I can't wait!

    As we say in support circles, "More bugs. More consultancy.". Now get your finance dept on the phone 'cos this new contract you're signing is gonna run for a very long while!

  7. CowHorseFrog Silver badge

    Would be interesting to learn how they support web excel, im guessing they compile the entire thing to wasm, but ive never heard of an actual details of the tech they use.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like