I am trying to execute some python scripts through VBA code.
.py files are working pretty well, but i am struggling with .ipynb files
running python script(.py) as following link :
https://stackoverflow.com/questions/73258152/how-to-exceute-ipynb-file-in-excel-vba-code),
but the same way doesn't work for ipynb files.
After quite long searching, i found this article
https://stackoverflow.com/a/62657958/19118788
and in this article, below code is suggested to run ipynb file in excel VBA.
Sub execute_notebook()
Dim objShell As Object
Dim new_cmd_window As String
Dim full_script As String
Dim activate_env As String
Dim change_dir_script As String
Dim convert_and_run_nb As String
Set objShell = VBA.CreateObject("Wscript.Shell")
new_cmd_window = "cmd /c"
activate_env = "cd /d [path to Anaconda\Scripts folder which on my machine is
C:\ProgramData\Anaconda3\Scripts] & activate [environment_name] &"
change_dir_notebook = "cd /d [path to folder where notebook is] &"
convert_and_run_nb = "jupyter nbconvert --to notebook --execute [notebook name].ipynb"
full_script = new_cmd_window & " " & Chr(34) & activate_env & " " & change_dir_script & " " & convert_and_run_nb & Chr(34)
objShell.run full_script
End Sub
Most of lines are understood, but i have no idea for [environment_name] in the above code.
(I am beginner to these things)
Please tell me, what should i do for [environment_name] ??