How to exceute ipynb file in excel VBA code

Viewed 35

I am trying to execute some python scripts through VBA code.

".py" files are working pretty well, but i am struggling with ".ipynb" files

for example to ".py" files, I can run them by simple code below.

Sub run_python_script()

    Dim wsh As Object
    Set wsh = VBA.CreateObject("WScript.Shell")
    Dim waitonReturn As Boolean: waitonReturn = True
    Dim windowStyle As Integer: windowStyle = 1   

    args = "path to something.py"
    wsh.Run "C:\Users\kingd\AppData\Local\Programs\Python\Python39\python.exe" & " " & args, windowStyle, waitonReturn

End Sub

On the other hand, ".ipynb" files does not work when i just substitute the file path ('args', in case of the above code) to that of ".ipynb" file.

What is the most simple way to solve my problem? (I am looking for the most simple, reliable way...)

Thanks for all answers.

0 Answers
Related