Use Python to replace VBA in Excel

Sdílet
Vložit
  • čas přidán 12. 11. 2020
  • Did you know that you can completely replace VBA in Excel with Python?
    Script and automate Excel using nothing but Python, and write macro functions (Subs) and worksheet functions (UDFs) using PyXLL.
    PyXLL
    www.pyxll.com
    Resources for VBA developers
    www.pyxll.com/learn-python
  • Věda a technologie

Komentáře • 266

  • @5StarsLuis
    @5StarsLuis Před rokem +6

    As a Python dev, I really do appreciate staying in 1 language for development, especially when I produce some of my reports in Excel using Python. Now it looks like I can also include "embedded Python" aka Excel macros written in Python in my reports! Excellent!

  • @Simaq7
    @Simaq7 Před 3 lety +7

    Many thanks for this video. I wanted to study Python and since I use excel spreadsheets daily, I then switched to VBA about 6 days ago. This was because I was unaware that one could "import" PYXLL into excel. My main goal was learning Python since I'm interested in both Data Analysis and Machine Learning. Your video just switched me over to Python.
    Once again, THANK YOU SO MUCH. I'm now a subscriber

  • @yacinegacem9923
    @yacinegacem9923 Před 3 lety +15

    One of the many: "Thank you!"
    Finally we got Python presented in Excel itself. Basically a hurdle less to embrass Python.

  • @RS-tx4bu
    @RS-tx4bu Před 2 lety +2

    This is simply amazing! Having the power of Pandas, Numpy, lists, dicts, regex, requests, multithreading, ML, ... and the easier than VBA Python syntax ... ALL now available inside Excel. I hope there will be something like this for MS Access as well someday. This is a game changer and you get the best of both worlds.
    Some wise man once said: "Learn a new language, get a new life."
    Hope you keep making many more videos like this.

  • @byteseq
    @byteseq Před 3 lety +42

    1. VBA does not usually index from 1 !
    2. This is still miles from being as convenient and shareable as things made in VBA.

    • @andyrobertson4096
      @andyrobertson4096 Před 3 lety +1

      There is 'option base' isn't there. You can set the base number for arrays.

    • @byteseq
      @byteseq Před 3 lety +2

      @@andyrobertson4096 yes, but 0 is still the standard

    • @TheLenbus
      @TheLenbus Před 3 lety +2

      @2. maybe you are right in terms of sharing, but in my opinion nowadays nothing beats the readability and extensibility of python code. It would be cool to see native Python-support embedded into Office Macros.

    • @4us2grow
      @4us2grow Před 3 lety +1

      Have you tried xlwings?

    • @logic3686
      @logic3686 Před 3 lety +1

      Totally agree. Not understanding how this is better than having the code written into the workbook you are giving someone to use.

  • @dansam1395
    @dansam1395 Před 3 lety +43

    It is a very interesting extension... but I don’t get the reason why it is offered as subscription, and why it is so expensive.

  • @gokulnaththeboss08
    @gokulnaththeboss08 Před 3 lety +107

    Dude there is a market demand where u can use python with excel in area of auditing /accounting where no one is teaching. I hope u start a series a based on those topic which would be so useful

    • @luisfernandocuestasanchez4343
      @luisfernandocuestasanchez4343 Před 3 lety +1

      Thank you for sharing that

    • @stevenmoore9805
      @stevenmoore9805 Před 3 lety +3

      Are you serious? There is a market for python/excel in accounting?

    • @gokulnaththeboss08
      @gokulnaththeboss08 Před 3 lety +6

      @@stevenmoore9805 yup but sad no one teaching these type of programming area for accountants

    • @Jeevaji14
      @Jeevaji14 Před 3 lety

      It's great video

    • @sanjaysharma-it9wl
      @sanjaysharma-it9wl Před 3 lety

      Can you give me reference on your statement. Because what I am hearing from you is unique. Just wanted to confirm that how you arrive on this statement. and eager to discuss with you if allow

  • @cyberhome101
    @cyberhome101 Před 3 lety +8

    Have you done a speed comparison?

  • @Esclarecidos
    @Esclarecidos Před 3 lety +1

    Do you know if it's possible to use an alternative VBA editor in Microsoft Office applications? The problem with the default VBA editor for Office is that on high resolution monitors it is impossible to increase the font size to the code area. I tried changing the font size on the menu TOOLS - OPTIONS - EDITOR FORMAT, but it didn't work. The command wasn't accepted. Somehow the font size to code area in default VBA editor is directed related to monitor resolution.

  • @excelmastervba
    @excelmastervba Před 3 lety +1

    WOW, this is awesome! 🚀🚀 I need to try that immediately 😄

  • @DavLim86
    @DavLim86 Před 3 lety +1

    Quick question, if the code were to run directly from python, do the user still need to enable macro in the Excel instance?

  • @andikanmfon5960
    @andikanmfon5960 Před 3 lety

    I have successfully installed pyxll and even included the pyxll add-in in my excel, but anytime I try to launch the jupyter note book in excel
    , I get a 'PyXLL: Ribbon Error' that states ' Error calling pyxll_jupyter.pyxll.open_jupyter_notebook'.
    Where am I getting it wrong please?

  • @yeknafaskesh1257
    @yeknafaskesh1257 Před 3 lety +2

    EXCELLENT - That was great and VERY well made. Thank you very much.

  • @logic3686
    @logic3686 Před 3 lety +1

    I see a lot of examples of using commands that reference changing the cells directly which is the slowest way of changing sheet data. I'm struggling to see how this is a replacement of VBA especially seeing how this is requiring an end user to use another type of program that they don't inherently have installed with windows whereas I can easily have buttons for them to run code in the spreadsheet of the same workbook I give them.

  • @Riddingwithvivian
    @Riddingwithvivian Před 3 lety +1

    Well done...excel might be the preferred platform for executing program code if it isn't already. That is good for me considering I have made a career around the program.

  • @josedimastovar266
    @josedimastovar266 Před 3 lety

    Espero poder aprender mucho mas con lo.que realiza ...gracias por.compartir sus conocimiento

  • @romanverner
    @romanverner Před 3 lety

    This is amazing. Thanks for posting this!

  • @big1975E
    @big1975E Před 3 lety

    Can python code be written to do the kinds of things that can be done using VBA but for Excel online?

  • @venusflytrap909
    @venusflytrap909 Před 3 lety +24

    VBA is just fine - if it aint broke then dont mess with it - the final python structure is not easily readable - VBA is well suited to Xcel - it's inbuilt and right there to start using with no add in requirements or seperate packages and buttons or loading modules, all very time consuming and more things to go wrong - if microsoft ever drop VBA it will be the worst decision they ever make.

    • @john1956c
      @john1956c Před 3 lety +6

      I agree. I do a lot of scripting in VBA and although it is no where near as flexible and easy to use as Visual Studio (Visual Basic) at let we have the tool within Excel to do these things. The video only helps someone that has Python experience and doesn't want to learn VBA.

    • @AxelTag
      @AxelTag Před 3 lety +8

      If Python were integrated to Excel you wouldn't say that. After a few programs maded in Python you can notice the diferences.

    • @john1956c
      @john1956c Před 3 lety +1

      @@AxelTag - Yea, well Microsoft won't change that. VBA is antiquated, but it does the job for what the user wants to do. They just need to know how to do it. Of course a Python user would prefer it in there as they are used to coding in it. I would prefer that C# was supposed, but it isn't.

    • @afonsosnow2192
      @afonsosnow2192 Před 3 lety +2

      Python is beautiful, VBA works well in excel and I think that MS will not drop VBA by python both can and should coexist.
      But think of the thousands of libs python has and the power it can give to excel ...

    • @hermanheunis9354
      @hermanheunis9354 Před 3 lety

      Agree 100%. I managed a whole factory dried fruit intake for two seasons with VBA. Programming is situational and VBA works out of the box in the office with Office. Python of course has its place and is very powerful, I run a Kivy App that measures productivity and sends the data to an off-site server, but unless your IT department starts installing Python on all the office pc's VBA can do everything you need. There is a guy from Wise Owl tutorials that even wrote a game in VBA that runs on a Spreadsheet.

  • @mikelennon1078
    @mikelennon1078 Před 3 lety

    Wondering for a person not knowing much about Codes, which code is easier to learn and use specially if the main interest is creating Relational Databases and or CRMs? VBA or Python or any other .

  • @CosmicBarrilet
    @CosmicBarrilet Před 3 lety

    Suscribed. Gonna curious inside the channel . Great vid, from a Python begginer.

  • @hiepnguyen220
    @hiepnguyen220 Před 3 lety

    If I built a huge library of Visual snippets. Is there any apps out there help converting from Visual to that¿

  • @mr_slave
    @mr_slave Před 3 lety

    Is there a possibility to choose which one we want to use every time we enter it? I'm working with vb in collage but I would like to try working with python cause I think it gives more possibilities? Anyone knows?

  • @jorgeramiroalarconvargas2580

    why do I get ipython into excel, when a jupyter notebook can make all that and more?

  • @JI9131
    @JI9131 Před 3 lety

    i did not find a reason why need to use Python to replace VBA in this case, which scenario we are talking abut to apply this?

  • @RajnishDubey1988
    @RajnishDubey1988 Před 2 lety

    how to call/execute excel macro using ( Java, .Net, Python) on server-side, where ms office is not installed??

  • @Joske920
    @Joske920 Před 3 lety +22

    29$/month ... really? thats to much for playing arround

    • @andressolar517
      @andressolar517 Před 3 lety +4

      try LibreOffice with APSO plugin.

    • @vivetytwo3205
      @vivetytwo3205 Před 3 lety +1

      An absolute rip-off and hostage taking. Use xlwings. It's free.

  • @NewStreamLine
    @NewStreamLine Před 3 lety +5

    Interesting. But I'm familiar with VBA and I think I'll stay with it. No need to use many different tools to get one thing working.
    Anyways, Python users might like that way of doing things.

  • @kenthomson9562
    @kenthomson9562 Před 3 lety +7

    If I were to send my excel file which includes python code, would all the recipients also need to buy/install python platform?

    • @python-excel
      @python-excel  Před 3 lety +2

      Any functions will need your Python code to be able to run, and so will also need the PyXLL add-in installed. If the person you are sending the file to doesn't need to recalculate anything just view the results then they don't need anything. Check out support.pyxll.com/hc/en-gb/articles/360036822253-I-want-to-share-my-work-with-others-Do-they-need-PyXLL-and-Python- for more information about this.

    • @kenthomson9562
      @kenthomson9562 Před 3 lety

      @@python-excel Thanks.

    • @scottparker6869
      @scottparker6869 Před 3 lety +4

      So python can do the same as VBA, why is python special?

    • @archardor3392
      @archardor3392 Před 3 lety

      @@scottparker6869 It is only special if you already know Python and don't have time to learn VBA but wouldn't mind dropping a bit of money. The reasonable course of action would be to learn VBA tbh, but if you really can't stand it, I would understand going to any lengths to avoid it.

    • @horseshoecrabs2000
      @horseshoecrabs2000 Před 3 lety

      @@archardor3392 Python has an incredible array of powerful libraries available to it that go above and beyond what VBA is capable of doing natively. One thing I immediately thought about after this video is that I could use the AWS Wrangler library with Python and push a spreadsheet directly to the S3 layer without having to exit the spreadsheet, call the python script, then reload the spreadsheet. Your workflow can exist solely in the Excel environment. That's very powerful. Other features of Python such as numpy and scipy for statistical analysis and scripting would allow for the creation of functions that would be too unwieldy for Excel's engine to handle well. Or you could do web-scraping and dump tables directly into a worksheet. This is a neat tool.

  • @Kapildevkushwah
    @Kapildevkushwah Před 3 lety +10

    I will give VBA priorty over python for excel use because u can record the codes even without knowing it.... We can not do recording in python we have to learn codes....

    • @krzysztofgie7936
      @krzysztofgie7936 Před 3 lety

      Recording should be banned. Macro recorder is responsible for a lot of garbage code.

    • @logic3686
      @logic3686 Před 3 lety +1

      @@krzysztofgie7936 LOL, I would agree but they can be useful for beginners staring out using the VBA interface.

  • @jg2077
    @jg2077 Před 3 lety

    And here is that other video I promised czcams.com/video/uEgJLLHBlZU/video.html
    This one automatically organizes music album files into their respective and automatically created folder. And it does this for all the alubms. So amazing to see it execute and do it all automatically. Hopefully I have this walk through video for other users and anyone who is interested in Windows Automation. Let me know if you get any questinos that I can help with.

  • @johnmcmanus6719
    @johnmcmanus6719 Před 3 lety +3

    Can't wait till they have this for SAP

    • @Mpmichi
      @Mpmichi Před 3 lety +2

      Incase you mean interacting with sap gui via python, there already is. Just search for SAP Gui scripting python.

    • @tizcoloko
      @tizcoloko Před 3 lety

      python has the db connector for sap java since nw03 and python odbc, now we have the db connector for python 3.8 for hana.

  • @WoottonRivers
    @WoottonRivers Před 3 lety +7

    I write a lot of VBA Excel code. The problem with VBA is that it doesn't run in online or smartphone versions. Will this solve this problem?

    • @FlowerBot
      @FlowerBot Před 3 lety +1

      use Office Scripts for office online

    • @davescott7680
      @davescott7680 Před 3 lety +1

      Doesn't the Add-ins written in JavaScript solve that problem?

    • @goombakiwi
      @goombakiwi Před 3 lety

      MS going to Javascript/Typescript.

  • @ronarts496
    @ronarts496 Před 3 lety

    Does anyone know if a similar thing is available for PowerPoint?

  • @neerajaggarwal4689
    @neerajaggarwal4689 Před 3 lety +4

    Great video!!!!
    But I have one problem. My clients needs VBA code to execute code. I can convince him to run run it with python but he needs to install python, jupyternotebook, pyxll etc.
    Is there any easy way to do this?

    • @python-excel
      @python-excel  Před 3 lety +1

      You can build a single installer that includes your code, Python and anything else you need. Take a look at www.pyxll.com/docs/userguide/distribution.html#building-an-installer.

    • @neerajaggarwal4689
      @neerajaggarwal4689 Před 3 lety +1

      @@python-excel Thank you for your reply. I will try to do the same thing. Hope it will help😀

    • @christianheffner92
      @christianheffner92 Před 3 lety +1

      Still do not see reason to use python instead of vba for this. Vba is installed in basically every computer, easy to use. Python just complicates things

  • @luisk5353
    @luisk5353 Před 3 lety +1

    Thank You, Sir!

  • @potorrero
    @potorrero Před 3 lety

    I have a complex excel workbook with many macros that updates lots of cells. Everytime I run one of these macros, it takes a lot of time to finish. Is pyxll faster than vba in such scenario? Also, if I send a pyxll enabled workbook to someone, the person would have to install pyxll also? Or it goes embedded in the file? Thank you.

    • @python-excel
      @python-excel  Před 3 lety

      Hi! It depends on what is slow about your current code, but Python can be much faster than VBA in some situations, especially with numerical calculations using numpy or pandas. Other users would also need PyXLL in order to call your functions, though any calculated values would be saved in the workbook (see support.pyxll.com/hc/en-gb/articles/360036822293-How-can-I-distribute-my-PyXLL-functions-to-other-users-)

    • @houstonvanhoy2198
      @houstonvanhoy2198 Před 3 lety

      Porterero: I am going to guess that you need need to turn off auto-calculate near the beginning of your VBA module(s), and then turn it back on at the very end of the macro. That might give you better speed. Good luck.

  • @setyoufree2726
    @setyoufree2726 Před 3 lety +1

    since you said we can replace VBA with Pyxll (python), how about user form in excel which controlled using VBA, can we execute that user form response using python also? similar with VBA?

    • @python-excel
      @python-excel  Před 3 lety

      Yes, you can create user interfaces using PyXLL too. Please see www.pyxll.com/docs/userguide/ctps/index.html for details!

    • @setyoufree2726
      @setyoufree2726 Před 3 lety

      @@python-excel - I will check it. Thanks for sharing your knowledge.

  • @trickydickybeer1
    @trickydickybeer1 Před 3 lety +12

    Interesting would the file work on other pcs without any installations

    • @davescott7680
      @davescott7680 Před 3 lety +7

      Nope. And that's one of the main reasons why I still use VBA almost daily, it's super transportable. I wish MS would make it so JavaScript or something could natively run from within a file. They already allow it as a web app, but that then requires hosting and other permissions and keys from IT.

    • @linomorin7682
      @linomorin7682 Před 3 lety +1

      You just need to have a python interpreter installed on the machine and all the modules installed as well

    • @thefamousdjx
      @thefamousdjx Před 3 lety

      I always hear this argument but people can always install extra programs, same way they would have installed Excel. Python brings more modern capabilities

    • @houstonvanhoy2198
      @houstonvanhoy2198 Před 3 lety

      the famous djx:
      Yes, people can install other software if enterprise IT allows it. That is not always the case.

  • @realbigbear
    @realbigbear Před 2 lety

    What are the benefits to replace VBA with Python in Excel? Better performance?

  • @vardansahakyan9805
    @vardansahakyan9805 Před 3 lety +2

    Why?
    Why should i replace native VBA, a powerful, robust and yet simple tool with this?

    • @sausagesmcgee7079
      @sausagesmcgee7079 Před 3 lety

      because VBA was fine in the 90s but it's really awful now

  • @jezreelmoraes5864
    @jezreelmoraes5864 Před 3 lety +4

    This is so cool, thanks for sharing

  • @GerryStilton
    @GerryStilton Před 3 lety +1

    I love the possibilities of PXLL but the pricing on the license is on annual basis and that becomes pretty steep at $240/ seat in a team of 10 and it stops working as soon as the licenses expire...got to make the pricing more attractive but at the same time I understand you're trying to make a living too. Great product with great use case but may be lower the pricing? Modify the licensing model? Tough call.

  • @Dara-lj8rk
    @Dara-lj8rk Před 3 lety

    Does this work if the excel file is sent to someone else who does not have pyxll addin installed?

    • @python-excel
      @python-excel  Před 3 lety +1

      Any functions will need your Python code to be able to run, and so will also need the PyXLL add-in installed. If the person you are sending the file to doesn't need to recalculate anything just view the results then they don't need anything. Check out support.pyxll.com/hc/en-gb/articles/360036822253-I-want-to-share-my-work-with-others-Do-they-need-PyXLL-and-Python- for more information about this.

  • @vanaraja5812
    @vanaraja5812 Před 3 lety

    Ultimate buddy.! 😍😍😍

  • @Rizwan1875
    @Rizwan1875 Před 3 lety

    Why should I do this in python if I can do it easily in vba? I didn't get the answer of this question...

  • @theminertom11551
    @theminertom11551 Před 3 lety

    I use excel in windows but python (and others) in Ubuntu. I see in the video you posted that Excel appears to be running in linux. How is this possible?

  • @pa6552
    @pa6552 Před 3 lety

    Assuming this only works on Windows and not on Linux/MacOS?

  • @dadisuperman3472
    @dadisuperman3472 Před rokem

    What is that Qt button for?

  • @tivan8040
    @tivan8040 Před 3 lety

    Any chance to get this in R?

  • @chrislow123
    @chrislow123 Před 3 lety +1

    Very educational....but why use Python over VBA in a workbook?
    Just looks like additional work and learning to me

  • @kofimensah6566
    @kofimensah6566 Před 3 lety

    Very Nice! Please do some tutorials on graphs!

    • @python-excel
      @python-excel  Před 3 lety

      Thanks! Take a look at the PyXLL docs here www.pyxll.com/docs/userguide/plotting/index.html for details of how you can use Python graphs in Excel.

  • @hapablap2088
    @hapablap2088 Před 2 lety

    Im using excel for school, If i change it to use python instead of VBA, what happens when I send the excel to the prof? Will it only work if he has the same software? Or will the excel file I sent to them just have python in it?

  • @saurabhtalele1537
    @saurabhtalele1537 Před 3 lety

    Good concept pyxl awesome sir

  • @nadimkhan-lm3ki
    @nadimkhan-lm3ki Před 3 lety

    This is amazing. Thanks for posting this!
    But I have a question I have huge VBA code and I want to convert it
    into python -- Reason because VBA is very slow it takes time. please help me to convert this VBA to python .. need your help ..

  • @life_in_gen
    @life_in_gen Před 3 lety

    Hi Sir, After you develop your own macro in Python how do you go about using this macro on other machines? Or your co-workers to use it as well. Thank u in advanced.

    • @python-excel
      @python-excel  Před 3 lety

      Hi! There are a few different good ways to do that. This FAQ article explains more support.pyxll.com/hc/en-gb/articles/360036822293-How-can-I-distribute-my-PyXLL-functions-to-other-users-

  • @manoharsagunthalla9215

    Your font is so small it not visible too please make font little bigger . Is it possible to do with Windows 7 ?

  • @luigidb
    @luigidb Před rokem

    Thanks a lot, you're very very clear. Just a question: if I want deploy python stuff to install as a package on other pc different than mine ... what I have to do? Can you explain it with a video on this subject? Thank you again.

    • @python-excel
      @python-excel  Před rokem

      Hi Luigi! This FAQ article should help with that support.pyxll.com/hc/en-gb/articles/360036822293-How-can-I-distribute-my-PyXLL-functions-to-other-users-. If you need any more help with that then just reach out to our support via the website 👍

  • @josenildoalmeida8799
    @josenildoalmeida8799 Před 3 lety

    Muito bom! Obrigado por compartilhar!!

  • @cswalker21
    @cswalker21 Před 3 lety +2

    I thought I heard a few years ago a rumor that JavaScript was going to replace VBA in Excel. Python seems like a better fit.

    • @goombakiwi
      @goombakiwi Před 3 lety

      Excel now incorporates Typescript(Javascript).

    • @cswalker21
      @cswalker21 Před 3 lety

      @@goombakiwi Interesting. Thanks for the clarification.

    • @tt9378
      @tt9378 Před 3 lety

      @@goombakiwi Really, does it need an add on? Just wondering if my company would allow it. My mind is racing at all the shadow IT I and many others in the company could create.

    • @tt9378
      @tt9378 Před 3 lety +1

      Just did a quick check and you have to have scripts switched on by an administrator. So that is a big fat NO from my company, allowing us to use typescript, Boooo 😂.

  • @mikelennon1078
    @mikelennon1078 Před 3 lety

    Wondering for a person not knowing much about Codes, which code is easier to learn and use specially if the main interest is creating Relational Databases and or CRMs? VBA or Python or any other ? Any chance you might have a sample file to see how it looks?

    • @houstonvanhoy2198
      @houstonvanhoy2198 Před 3 lety +1

      Mike Lennon:
      You might want to research Access, the desktop database that refuses to die. Like Excel, it has a huge installed base of applications in many companies and a corps of devoted developers. Sort of like COBOL, except that COBOL practitioners are retiring in droves with no one to replace them.

  • @alecouto
    @alecouto Před 3 lety

    This is beautiful...

  • @accountingsapayag
    @accountingsapayag Před 3 lety +2

    I don't think Python will ever replace VBA in Excel. When I first studied VB in the mid 2000's VB6 came in... and the that was the last of the VBs because .NET came. VB.NEt which was very different although similar to VB6. It didn't even replace VB6. There were good arguments there that experts said that there was no urgent reason to jump from VB6 to VB.NET. Python won't be any different. Power Query adds to VBA in Excel and SQL has always been there to manipulate data with Excel(only a few knows... and those who know won't ever feel there's a need for Python in Excel). Last reason, You have to convince those who have invested in VBA since time immemorial and tell them Python would be better while I go grab my popcorn and watch. These were similar to those people who didn't even budge when VB.NET came. But great creation mate... kudos.

  • @deal2live
    @deal2live Před 3 lety

    Does this work on macOS?

  • @JHatLpool
    @JHatLpool Před 3 lety +1

    Really good. Thanks for posting.

  • @martinriedel1911
    @martinriedel1911 Před 3 lety +7

    Great video! Can you clarify what the big benefit of using Python over vba is? Is it faster to execute, or can it run i paralell etc?

    • @lotuskillerlp4736
      @lotuskillerlp4736 Před 3 lety

      I guess python provides more opportunities to interact with different platforms. Moreover if yoyr are used to python its much easier to continue instead of learning vba which could be quite uncomfortable as i think.

    • @mr.RAND5584
      @mr.RAND5584 Před 3 lety

      Concise, easy to read.

    • @kevinl.9657
      @kevinl.9657 Před 2 lety

      If you want to do everything inside Excel, VBA is great. But if you want to connect things to Excel, for example, getting data from web scraping, putting it into a SQL database, putting it into excel, transform data, create an interactive visual report or interactive GUI, then compared to VBA, Python is better.
      TLDR; If you only care to do things inside Excel, VBA is fine. If you want to do something outside and inside Excel, Python is the way to go.

  • @uncommonsense360
    @uncommonsense360 Před 2 lety

    Do workbooks still have to be macro-enabled using PyXLL? Because if this can avoid macro enabling, that would add lots of security to Excel.

    • @python-excel
      @python-excel  Před 2 lety

      There's no need for the workbooks themselves to be macro enabled as the PyXLL macros run as part of the PyXLL add-in. As long as the PyXLL add-in is trusted then its macros will be enabled.

    • @uncommonsense360
      @uncommonsense360 Před 2 lety

      @@python-excel so I assume this wouldn't run if shared with someone else?

    • @python-excel
      @python-excel  Před 2 lety

      @@uncommonsense360 You would also need to share your Python code and the other user would need PyXLL. Please see this FAQ for more details on this support.pyxll.com/hc/en-gb/articles/360036822253-I-want-to-share-my-work-with-others-Do-they-need-PyXLL-and-Python-

  • @user-fx2ku5hh7i
    @user-fx2ku5hh7i Před 3 lety

    Даёт ошибку в строке "xl = Dispatch('Excel.Application')". Возможно, из-за старой версии Excel (i have v2007)
    I am not a programmer, but i need to run the macros.

    • @user-kk4ku1jh3i
      @user-kk4ku1jh3i Před 3 lety

      import win32com
      from win32com.client import constants
      #xl=Dispatch("Excel.Application")
      # вместо Dispatch лучше вызывать EnsureDispatch
      xl = win32com.client.gencache.EnsureDispatch('Excel.Application')

  • @henrikijonkoping4694
    @henrikijonkoping4694 Před 3 lety

    Are there any other programming software that works like VBA? Anybody who knows?

  • @sakuranooka
    @sakuranooka Před 3 lety

    Does this also work on Mac OS?

  • @onehumanwasted4228
    @onehumanwasted4228 Před 3 lety

    Do you need to have PyXLL installed to just run a python macro?

    • @python-excel
      @python-excel  Před 3 lety +1

      Yes, you will need to have the PyXLL add-in installed in order to run any Python code in Excel, including macros.

  • @2hockeystixneil
    @2hockeystixneil Před 3 lety +1

    Is there a difference between the two languages? Is python better than VBA for excel? Im just wondering because im currently learning vba and was thinking about learning python instead. Great video btw!

    • @python-excel
      @python-excel  Před 3 lety +3

      Haha well that's a very good question :) I would of course say that Python is much better but I am biased! What I would say is that there is far more of an ecosystem of packages available for Python than for VBA, and Python is more 'generally' useful since you can run it both inside and outside of Excel, whereas VBA you're stuck with using it in Excel (or other Office tools). Thanks, glad you enjoyed the video :)

    • @shobhitnsaxena
      @shobhitnsaxena Před 3 lety +4

      @@python-excel I agree with you for your preference of Python over VBA but my perception is little different, in excel VBA is very easy and I learned by my own without anyone's help but for Python we need to go for proper course to learn and more over VBA is very easy for excel we can do anything. Now I am using python just to get the live data updates, which is also available in VBA............. But still we can not compare Python and VBA both are completely different...

    • @KentBrakewell
      @KentBrakewell Před 3 lety

      The loss of intellisense features is a huge drawback. Is there a work around?

    • @7H0M4591
      @7H0M4591 Před 3 lety +2

      VBA is extremely powerfull, but you will hardly find any libraries like you do on Python.
      Nevertheless I did not discover any problem so far, that I couldn't solve by VBA. The only thing that comes on my mind is that VBA isn't able to use mulitthreading. There is a workaround, but it's not stable!

  • @bourbe
    @bourbe Před rokem

    Hello excellent ! I have a question please, let's Say I want to send m'y file with my code to someone who doesn't have python install in his PC, all the calculation in my excel file with my code will work in his PC ?

    • @python-excel
      @python-excel  Před rokem

      Hi, thanks for your question! Yes your end user will need to have the PyXLL add-in set up, but that is not hard and can be scripted for them. This link explains more, or contact us via the PyXLL website if you need help with this support.pyxll.com/hc/en-gb/articles/360036822293-How-can-I-distribute-my-PyXLL-functions-to-other-users-

  • @vince8520
    @vince8520 Před 3 lety +5

    It's very interesting, but I still like VBA better, sorry. And I'm sure there is a point where VBA is not replaceable.

  • @chulakapitigala5147
    @chulakapitigala5147 Před 2 lety +1

    Wow that's awesome 😎❤️

  • @pearsonyam8676
    @pearsonyam8676 Před 3 lety

    I can't see anything you're typing in the cmd/terminal..

  • @casual_gamer1413
    @casual_gamer1413 Před 2 lety

    I'm a python web scraper and I have good grip on python, so, Should I go for VBA or continue with the python to handle excel problems?

    • @python-excel
      @python-excel  Před 2 lety

      For web scraping Python is far more capabale, IMHO. Imagine trying to reimplementbs4 in VBA!!

  • @jorgesousavieira1817
    @jorgesousavieira1817 Před 3 lety +1

    Why would anyone choose to use Python instead VBA?, without the VBA IDE you have to remember in memory each property and method and usage of the object model, besides to write by hand all those kilometric commands in the console. Is the same you choose to use Linux instead Windows for PRODUCTIVITY WORK.

  • @IBITZEE
    @IBITZEE Před 3 lety

    Excelent video... explicit "qb" in the right dosage...
    ?are there any other languages that work with Excel... and with Jupyter notebooks... (Javascript, C#-Script, ???)

    • @davescott7680
      @davescott7680 Před 3 lety

      C#, VB.NET and I think C++. Can all write Add-ins, Google VSTO addins for guides on how.
      JavaScript and any other web language can also be used, Microsoft have simply confusingly decided to call these simply 'Add-ins', they require web hosting and online, and appear as panes on right side of excel.

  • @k_bv
    @k_bv Před 3 lety

    I came to Python from VBA. My opinion is if you are beginner and you need just some macros to make your life easier in Excel, you don't need Python. I miss a lot VBA debugging tools, believe me when you start, you will need them. If you are average user I don't think that you will reach VBA limits. Where Python shines are array operations, this is at least what I see for now, after my short Python experience. May be later I'll could say more.

    • @ajayrathod7777
      @ajayrathod7777 Před 6 měsíci

      Now what is your view can I do incredible report generation using python?

  • @cryptomugen1315
    @cryptomugen1315 Před 3 lety

    thank you for this antastic tutorial! hope you can create a similar tutorial with a real use case. e.g. a function that can scrape data from a web page and then append to existing data in am Excel file.

  • @rameshd468
    @rameshd468 Před 2 lety +1

    Many many Thanx

  • @r.a.8618
    @r.a.8618 Před 3 lety

    If I'm going to share the Excel file with other users, then obviously I need to have Pyxll add-ins installed in all their PCs as well. Don't see why I should do that.

  • @rerhart585
    @rerhart585 Před 3 lety

    The problem with this paradigm is that it will limit you to a the Single Apartment Threading limitation to the Excel Com Object

    • @python-excel
      @python-excel  Před 3 lety

      With PyXLL you can write multi-threaded Excel add-ins, including UDFs that run in parallel. Please see support.pyxll.com/hc/en-gb/articles/360037298034-Can-Excel-call-Python-functions-in-parallel- for details.

  • @RichardPeterShon
    @RichardPeterShon Před 3 lety

    Python is like an improved version of Basic, so it is inevitable python would come onboard oneday.

    • @sajeerks1708
      @sajeerks1708 Před 3 lety

      Why bother python coding. Already macro function is there. So isn't enough to use with a mouse click. Please share the use of python🤔

  • @AStCG1989
    @AStCG1989 Před 3 lety

    I’m getting an error message when I attempt the xl.range. #The method range is actually a propert....

    • @python-excel
      @python-excel  Před 3 lety

      Python is case sensitive so you need to use xl.Range with a capital R.

    • @AStCG1989
      @AStCG1989 Před 3 lety

      @@python-excel I’m also getting an error when I try to work through the add in. Will trying to do code in two separate terminals cause an error?

  • @bogdanexit1
    @bogdanexit1 Před 3 lety

    Vba is faster (only if in python you don't use numpy ) , simple and accessible with no restriction in lot of company

  • @CasparusBadenhorst
    @CasparusBadenhorst Před 3 lety

    Nice. will Phython work for Excel 365?

    • @PhilHibbs
      @PhilHibbs Před 3 lety

      As I understand it Excel 365 can't do VBA macros, so I'd expect not.

  • @karthikmngowda
    @karthikmngowda Před rokem

    Is it possible to write python code in vba?

    • @python-excel
      @python-excel  Před rokem

      You can write Excel macros in Python, which can then be called from VBA using the "Run" method. It's common to do this when migrating a large code base from VBA to Python as you can re-write just some parts in Python rather than having to do everything at once. This page explains more www.pyxll.com/docs/userguide/macros.html.

  • @lashlarue59
    @lashlarue59 Před 3 lety

    What version of Excel are you using?

    • @python-excel
      @python-excel  Před 3 lety +1

      Hi Michael! That video was made using Office 365, but PyXLL supports all version of Excel for Windows from 2003 through to the latest.

    • @CasparusBadenhorst
      @CasparusBadenhorst Před 3 lety

      I thought Office 365 use Office Script or is VBA also available in 365?

    • @python-excel
      @python-excel  Před 3 lety

      @@CasparusBadenhorst I believe you're thinking of Office Online. Office 365 refers to the subscription version of Office, which is available for Windows, macOS and online. PyXLL requires the Windows version of Excel. This video was made using Office 365 for Windows. Hope that clears things up!

  • @hamidlfanid8556
    @hamidlfanid8556 Před 3 lety

    Intéressant je travail avec Excel je veux apprendre plus sur ce sujet

  • @HardieYe
    @HardieYe Před 3 lety +1

    VBA is much much convenient. Doesn't need to install any plugins

  • @billmckinzie
    @billmckinzie Před 3 lety

    Is Python faster?

  • @typeer
    @typeer Před 3 lety

    Tyvm!!

  • @BheeshmaYT
    @BheeshmaYT Před 3 lety

    iam getting above thing after running following code
    xl=Dispatch("Excel.Application")
    xl
    kindly help in this

    • @python-excel
      @python-excel  Před 3 lety +1

      That's the COM Excel.Application object, but it's using a dynamic wrapper class (late bound) instead of a generated one (early bound). You can use it in the same way as the one in the video, or you can use "win32com.client.gencache.EnsureDispatch" instead of "win32com.client.Dispatch" to force win32com to generate the specific wrapper class. You can read more about late bound vs early bound com objects here www.icodeguru.com/WebServer/Python-Programming-on-Win32/ch12.htm.

  • @rajdipsarvaia6641
    @rajdipsarvaia6641 Před 3 lety

    This is fucking awesome

  • @sausagesmcgee7079
    @sausagesmcgee7079 Před 3 lety

    I prefer ExcelDNA and using C# to write custom addins - it's the dogs nuts

  • @patrickmullot73
    @patrickmullot73 Před 3 lety +5

    What’s the point of that? You’re just using the Excel API.
    What would be a real life scenario (in an actual enterprise) where using Python could bring some benefits?

    • @markippo
      @markippo Před 3 lety +1

      Honestly everything what you're allowed to do in your operating system. Not only what MS allowed you to do in vba sandbox. You can extend Excel capabilities using python's statistical or AI libraries with easy integration with Excel's data model. You can create automated, interactive, easy to read reports and so on. Yeah of course, if you want to take some data from spreadsheet or put them into, you need to use Excel's API, but in between you can utilise full python potential. Finały - as a script language python is more user friendly and flexible. You've got tons of libraries. Typing is dynamic. You've got lists, dictionaries, sets, tuples, implement objec oriented approach if you want. You can create generators, iterate via multiple stuff at once.

    • @patrickmullot73
      @patrickmullot73 Před 3 lety

      Thanks for answering! There is no doubt that python is way more powerful in any sense than VBA, but I still think that if you need such power for your use case, you’re much better off importing the data from the Excel sheet using pandas in a Jupiter notebook (or Google collab). If you need presentation, python has tons of libraries for that, and you can still export your output data to excel.
      If you just want to do simple stuffs inside Excel, usually vba is enough.

  • @linus8976
    @linus8976 Před 3 lety

    openpyxlは?

  • @seyfullah642
    @seyfullah642 Před 3 lety

    They need a mac version of pywin32.