+ Reply to Thread
Results 1 to 3 of 3

Python vs VBA with Excel

  1. #1
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    812

    Python vs VBA with Excel

    Hi,

    I am a daily user of Excel and would like to learn how to automate some tasks.

    The obvious choice is to learn how to programme with VBA.

    However, I would prefer to learn Python and I don't really have the time to acquire proficiency in both languages.

    Is it possible to accomplish in Excel using Python all that one can do with VBA? I.e. is it possible to replace VBA completely with Python?

    Are there any downsides to using Python rather than VBA with Excel?

    Thanks!

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,938

    Re: Python vs VBA with Excel

    The main downside that I see with Python rather than VBA is that Excel does not natively support Python and MSFT doesn't seem interested in officially helping build support for Python interacting with Excel. So you are kind of on your own using third party add-ins/libraries like xlwings (https://www.xlwings.org/ ) to get your Python macros to interact with Excel. I personally never figured out how to get xlwings to work for me, and this late in my career (old dogs, new tricks, and all that) I have not had the motivation to figure it out, but I know that some on here have made it work.

    The big advantage I potentially see is that, because VBA is specific to Excel/MS Office and doesn't port well outside of MS Office, python macros may port more easily to other spreadsheets. I know that LO Calc has some built in support for Python macros. It seems possible that one could program their macros and user-defined functions in Python, then use those macros/functions in any spreadsheet, once you figure out how to get each spreadsheet to interact with Python.

    If you are early enough to be choosing a programming language, I might suggest that you consider Javascript. MS Office's new developer model seems built on Javascript/Typescript type languages. Google Sheets has long used Javascript as its primary macro language. LO Calc has built in support for Javascript. At this stage, I feel forced to use Excel/MS Office because I learned VBA and VBA does not port well outside of MS Office. If I were a young dog deciding what tricks to learn, I might be inclined to learn Javascript because the three main spreadsheet competitors (and minor ones as well) know how to work with Javascript, and I would be free to choose a spreadsheet application based on other strengths and weaknesses.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    812

    Re: Python vs VBA with Excel

    Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Running a Python Script from Excel VBA
    By DeanMcK in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2021, 05:26 PM
  2. How to use python language with excel
    By jorel in forum Excel General
    Replies: 4
    Last Post: 05-14-2018, 03:12 AM
  3. Python or VBA in excel
    By songhaegyo in forum The Water Cooler
    Replies: 49
    Last Post: 01-11-2018, 12:40 PM
  4. python in excel
    By idandush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2015, 04:26 PM
  5. call a python script from excel vba
    By sheffieldlad in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2013, 07:11 PM
  6. Python commands in Excel
    By ljoseph in forum Excel General
    Replies: 0
    Last Post: 09-18-2009, 07:02 AM
  7. Excel and Python
    By davidlawrence in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2008, 08:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1