Feedback by UserVoice

How can we improve Excel for Windows (Desktop Application)?

Python as an Excel scripting language

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

5,219 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Daniel shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    Accepting Votes  ·  AdminExcel Team [MSFT] (Admin, Office.com) responded  · 

    Wow.

    Thank you to all those participated in our survey. What an amazing number of responses, many of them with very deep content. We’re processing the over ten thousand responses(!), and already appreciate the time so many of you took to answer with passion and experience.

    Please know this survey is used to help influence various topics – both on Python as well as other related topics that the comments started to bleed into. Given the passion, I want to be clear this remains an area of exploration for us, without any specific timeline.

    We’ll provide updates as we progress on this feature request.

    Thanks!

    Ashvini Sharma
    Lead Program Manager
    Excel

    386 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Stechyos commented  ·   ·  Flag as inappropriate

        @alpha6qcsDB you're right. However you forgot one thing: if MS provides just a good API, these tools can be used just by tech savvy people. If MS includes python in excel, sheets/workbooks could be crafted with python scripts and deploy the more people w/o provide support for installing excel add-ins and python virtual environments, so this will be more 'portable', efficient and less time-consuming.

      • alpha6qcsDB commented  ·   ·  Flag as inappropriate

        Since Microsoft has embraced opensource.. it would be good if they just made good interfaces that other languages and frameworks could tie into.. and let the best one win. There are a huge number of existing python interfaces

        1. xlwings
        2. openpyxl
        3. pywin32
        4. comtypes
        5. ctypes
        6. Iron Python
        7. datanitro
        8. pyxll

        There are atleast 10 more..

        All these depend on the COM interface. So instead of trying to add another implementation to the mix. It would be good if MS made the COM interface more reliable, well documented for Excel.. and perhaps drive some resources to the opensource development of the basic libraries such as ctypes, comtype, win32 etc which the other libraries are dependent on.

      • vinson commented  ·   ·  Flag as inappropriate

        Vote for Python !
        Plus, please add a modern bulit-in code editor in Excel for code editing, vs code may be the right one. VBE, the not smart dev env , really hurts.

      • Harvey Ellis commented  ·   ·  Flag as inappropriate

        Some form of this is a very good idea. Building health economic models for clients in the pharmaceutical industry, it is nigh-on-impossible to get them to agree to anything but basic excel. Even R scripts, with code that is fully contained within a single script is difficult for them.

        The main problem is versioning, and being able to provide a model in a single package - with no external dependencies. Therefore, I do wonder whether some of the more esoteric, but still rather useful packages would be supported in the Excel Python Interpreter. Perhaps there might be some kind "compartment" within the excel file for packages to be shipped within the file? (I am unsure how this might work.)

        Or, perhaps as others have said, integrating VS code, with F#, C# or VB.NET support would be the way forward - allowing further extensibility, automation and performance whilst still within the Microsoft ecosystem.

      • Reza commented  ·   ·  Flag as inappropriate

        In my opinion, adding the ability to writing Python scripts in excel in macros or as worksheet functions, is precisely same as connecting two closed oceans and get the advantage of boating on the vast open waters.

        It is fantastic and I am ready to jump to that ocean.

      • Excel User commented  ·   ·  Flag as inappropriate

        Hi, I am almost finished with a master in finance. While interning 2 years ago I started VBA. One thing that I don't like is that i wonder if i am investing a lot of time in learning a language that will be dead in a few years. PLEASE, give information on what is going to happen in the next 5 years. I don't mind learning Python or whatever needed, but since most of the Excel users are not with IT degrees e.g. business, finance etc. we need some time to learn! I don't want to be fired because a skill that i have is obsolete. Btw Thank you! Excel is awesome :)

      • Frans commented  ·   ·  Flag as inappropriate

        Well, it’s a bit of a double edged sword. I quite like the vba object structure as it’s intuitive, fits well with the interface and exposes pretty much everything available. The excel user interface to data inspection and data entry are hard to beat. And using the data with vba is good, but over decades I have had to build up vba objects to do most of the work on lists, file and automating writing to cells. Simplification of these tasks are definitely possible. and some api calls are needed. Python is a scripting language designed on a number of simple data structures and a rather pervasive object model where a newby does never quite know what’s going to happen where (eg typical calculator functions are ‘hidden’ in math; regex, list comprehension and magic methods all require a bit of a mindset ) There is a lot of confusion out there on the web, and the answers to simple questions sometimes have to go into some quite considerable depth. In many ways though python and vba are not so different, both being strongly object driven, however when teaching students to program, better(well more aesthetically pleasing) outputs are generated much quicker though I must admit I do give the a readcell and writecell function. I like the messy data calculate and display and the creativity it’s allows, but accept that this is not so good for business critical stuff. The vba editor is a bit overdue a overhaul as well. All in all, I can see the fit, but I fear the knowledge overhead required compared to learn python is significantly higher and that of vba and may put people with No computing experience. But a need to automate some tasks. I think a two level approach with a ‘vpa’ In which several core modules and the excel api are exposed, but users can start immediately, and can use standard functions like on, sum etc and the output is integrated in the excel sheets (seamless integration of the vba editor in excel as VPA tabs). And alongside that a more business process formal python api/integration with its own pip to load modules in the xl file.

        Two key things should not be lost: I) the ability to send the spreadsheet any where to any company and they can run the code straight away without installing packages, python etc. You don’t won’t to have users needeing to engage w it just to open your code

        2) please keep the explicit keyword, and leave it case insensitive. In python every typo is a pain ( I know that’s 3 really)...

        Exiting times,

        Goodluck!

      ← Previous 1 3 4 5 19 20

      Feedback and Knowledge Base