How To Execute A Python Script From Excel Using VBA | Step-by-Step Tutorial [EASY]

How To Execute A Python Script From Excel Using VBA | Step-by-Step Tutorial [EASY]

Coding Is Fun

3 года назад

82,148 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@chrisjollmann5819
@chrisjollmann5819 - 01.12.2023 00:09

Hi,
Thx for the video
My code is failing because the script cannot read the excel that is already open. What can I do about it?

Ответить
@AndreaBertini_official
@AndreaBertini_official - 11.11.2023 22:33

top vide, thx for your precious work

Ответить
@hagataaersadaginting8932
@hagataaersadaginting8932 - 25.08.2023 11:59

This is a great video! one question though, how can we return feedback if there is an error on the script's run, without having to check into the terminal?

Ответить
@divz2646
@divz2646 - 29.06.2023 23:50

Pycharm can be used or not?

Ответить
@user-ql6vg7gf4h
@user-ql6vg7gf4h - 06.06.2023 09:40

Amazing, outstanding, so easy to follow

Ответить
@Moo-vd3ej
@Moo-vd3ej - 01.05.2023 17:41

I am having a problem where the python window flashes and then the excel workbook crashes upon running the VBA code. Has anyone else encountered this error or know of a solution?

Ответить
@luciferp6132
@luciferp6132 - 17.04.2023 12:25

I'm trying to run this my python just open and closes within second without running the code can you please let me know what to do in such case

Ответить
@Enzoluino
@Enzoluino - 24.01.2023 17:06

Hi, thanks for this great video ! I have a problem trying to use it : I get this : ModuleNotFoundError: No module named 'plotly' and lines from 4 to 6 in your codes are underligned. Any idea where it comes from ? thank you

Ответить
@pav7611
@pav7611 - 04.11.2022 23:35

Just what I was looking for. I want to replace tkinter and use excel as the interface.

Ответить
@MrJanjai
@MrJanjai - 04.11.2022 14:41

Could it be a problem if one is using python within spyder?

Ответить
@PraveenKhunte
@PraveenKhunte - 26.10.2022 06:50

Can something be done to run the terminal in background instead of popping-up every time, when we run the VB command

Ответить
@kimvandenhouten8101
@kimvandenhouten8101 - 19.10.2022 13:05

Hi there. I would like to learn how to pass variables through python functions by using VBA. I am interested in VBA within Arena Simulation Software, so I cannot work with the Excel add-ins. Thanks a lot in advance

Ответить
@unnishkrishnan4651
@unnishkrishnan4651 - 14.10.2022 11:39

Great information.. can you help me how to run this on Mac OS, When i tried this it generates "Activex Components cant create object " Error . Thanks

Ответить
@philipporwisch1776
@philipporwisch1776 - 14.09.2022 22:35

I‘m wondering how would I enable the functionality, so I can share it with users who use windows pc‘s, as well as Mac’s?

Ответить
@yeojunjie1852
@yeojunjie1852 - 25.08.2022 05:27

FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\junxi\\Python\\python39.zip'

hi i get the above error, please advise

Ответить
@stuartstocks6676
@stuartstocks6676 - 18.08.2022 17:19

pythonexepath is different if using anaconda "where python" not going to give the answer you seek

Ответить
@slbmonitor5626
@slbmonitor5626 - 09.08.2022 22:30

Can this be done using C#?

Ответить
@suhardisjahrial3318
@suhardisjahrial3318 - 16.07.2022 17:09

What I like about your videos is the to-the-point explanation -- kein Quatsch.

Ответить
@johannesgjerdaker2235
@johannesgjerdaker2235 - 22.06.2022 12:58

Hi, thanks for a great video! Which python compilers does this work on? Tried using Jupiter Notebook from Anaconda with no luck.

Ответить
@ria7725
@ria7725 - 06.06.2022 17:42

It doesn't work for me. I get an error" Method 'run' of object 'IWshShell
3' failed." Could you help to figure out what is wrong?

Ответить
@lionatticus9743
@lionatticus9743 - 21.05.2022 08:14

Great video! Thank you! If you wanted someone on another computer to be able to run this, how about you go about that? Send a zipped file with Python installed with the folder directory or would there be code that could locate the python path…?

Ответить
@bala2520
@bala2520 - 20.05.2022 15:25

Thankyou so much, one doubt, do we need to do pip install xlwings to connect python from Excel?

Ответить
@lionatticus9743
@lionatticus9743 - 19.05.2022 05:14

Holy crap!! Thank you soooooo much. This is AWESOME!!!

Ответить
@malcolmmckean9388
@malcolmmckean9388 - 27.04.2022 02:46

Great Video! Was wondering if there was way to run the VBA program when you save the excel file? Essentially what I want to do is run a python script whenever a change is made to the spreadsheet.

Ответить
@innotect6464
@innotect6464 - 26.02.2022 21:29

Great Idea for call python script from Excel file. Thanks :D

Ответить
@giogobronidze7788
@giogobronidze7788 - 09.02.2022 22:57

what could be the reason of Perimissionerror, VBA code works but when i try to run the script from CMD i get the premissionerror. Python code separately works well too

Ответить
@manupandit3864
@manupandit3864 - 08.01.2022 20:19

Hi

Getting run time error ‘429’

ActiveX component Can’t create object

Is there a way to solve this error?

Ответить
@roelsanchezcalle9789
@roelsanchezcalle9789 - 14.12.2021 19:18

Thanks!!!!!!

Ответить
@manish23march
@manish23march - 11.12.2021 23:54

Great tutorial!
But rather than writing a Macro, I tried to add the hyperlink in the excel sheet. For small program(without external lib) it works well by opening Command Prompt, but it fails to run if I include Panda library. Do you know how can I resolve this using just the hyperlink?

Ответить
@slickbuyers
@slickbuyers - 19.11.2021 10:37

great stuff @coding is fun, learning a lot of things from this channel, one question can we make it a lil bit more easy like, we dont have to save each time and we dont have to press any button to execute the program, its like we put any value on any particular cell and press enter to execute. i need this real time update feature from excel for a project, atleast tell me what to research. thank you

Ответить
@santhoshreddykesavareddy1078
@santhoshreddykesavareddy1078 - 23.10.2021 17:54

Wow! Super useful Thanks! much :). This will really help for everyday morning tasks. I have a question.. here we're doing the python stuff outside excel which means if we want to share , I'm assuming we have to share the python script as well which is not recommended. Is there a way to write python right inside excel so that it will be easy to share and run anywhere ?. Thank you

Ответить
@eltonm.t.873
@eltonm.t.873 - 19.10.2021 15:22

Very useful teaching! One could also use Excel VBA to run any kind of Python script to do different things, even things that are not supposed to return to Excel! Great!

Ответить
@kadi_chetty
@kadi_chetty - 07.09.2021 10:45

Hi - great lecture
For me when I run python on an xlsm file - the excel file gets corrupted - any ideas?

Ответить
@ckwirey
@ckwirey - 22.08.2021 17:01

I need help. I've copied this to the letter, but it still does not work. Here's what is supposed to happen: VBA script fires, triggers Python code, and Python code writes back into the Excel file. From the Python side, it works. I can initiate the Python code, and watch it make changes to the Excel file. However, I want the trigger event to occur inside Excel. As of now, the VBA script fires, the shell flickers, but nothing happens. Can anyone walk me through what is (or more appropriately, isn't) happening?

Ответить
@timlambe8837
@timlambe8837 - 07.08.2021 16:50

Hey, what can I do if i want to send the .xlsm file to someone else, who doesnt have the .py file on his Computer?

Ответить
@SaulEduardoo2
@SaulEduardoo2 - 06.08.2021 08:14

Hi Sven, in order to make the code worked on my laptop I had to make some changes, I added the openpyxl module to the requirements and I used the chdir as this os.chdir("Current Path where the files are contained")

Just after that, the code ran well. The problem was that wasn't generating the .html file because there was an error with some "traceback" after that the interpreter showed some folders that there were problems executing the "df=pd.read_excel('Tasks.xlsm')"

Ответить
@nithink94
@nithink94 - 04.08.2021 10:44

Thanks a lot for this great tutorial. Is it possible to run a python.exe file instead of a .py file?? I would want to share my project with others who won't be able to install python in their system. so I converted the .py file to a .exe file. seems like your code is not working for the .exe file.

Ответить
@datsmile47
@datsmile47 - 03.08.2021 04:09

Hi bro, when i try to use your file (already insert python.exe and your python code), excel notify that error '5', invalid procedure call or argument, how can i fix it ? thanks bro

Ответить
@user-rf3fo7iu7u
@user-rf3fo7iu7u - 24.07.2021 10:45

DIM in Basic is array definition. Why those objects are defined as arrays? Or, may be, I confusing something?

Ответить
@peterrasmussen1972
@peterrasmussen1972 - 03.07.2021 08:25

Very usefull!, From within your RunPythonScript, is it possible to check and activate a specific Python virtuel environment module + pip install -r requirements.txt ?

I really appriciate if you can give me a hint, since Im used to work with multiple venv inviroments on my same computer

Ответить
@gabrielervolino591
@gabrielervolino591 - 01.07.2021 19:18

Very Good! Thank you! Is it possible to add an execution of python script inside an existing macro?

Ответить
@francescogelio4451
@francescogelio4451 - 28.06.2021 16:22

Is python faster than vba?

Ответить
@marcel7705
@marcel7705 - 07.06.2021 06:14

Hey, great video!

I was wondering if you could help me:
I want to do exactly the same thing you did on this video, but I coded using Anaconda and Jupyter, therefore my file is .ipynb and your vba code did not work for me. Do you have any insight on why it doesnt work?

Really appreciate any help you are able to provide.

Ответить
@sankarachari
@sankarachari - 26.05.2021 17:48

Thanks a lot.

Ответить
@martinaraya2282
@martinaraya2282 - 10.05.2021 06:15

Very nice video ! Thanks!

I´m trying to use your code for a project, I also need to run a Script from an excel, but when I run the code of VBA, it does not throw any error, but it dont run my script. after I press the button, i can see a kind of flash, but nothing.

The file that contains the script is a .IPYNB, because im coding in Jupyter, could be this the error?

thanks for your help, I appreciate a lot.

Ответить
@leandrosantoscosta9621
@leandrosantoscosta9621 - 08.05.2021 06:17

you are the best, pity I know only basic English, but you is very good, congratulations.

Ответить
@Anastasia-wy1uj
@Anastasia-wy1uj - 19.04.2021 22:27

Arrrrrlight 😁

Ответить
@wjffhfgj7045
@wjffhfgj7045 - 18.04.2021 20:03

Thanks

Ответить
@hamidrezaie5866
@hamidrezaie5866 - 01.04.2021 05:59

Very nice video ! Thanks!

I use your code for a little project. But i have a problem. I want to execute a python script from excel using vba. After executing the python script the next vba-makro should start. But my problem is that the makro starts altough the python script is not finished. How can i extend your code that the next makro starts only if the execution of the python script is done?

Ответить