I have created a python script that takes inputs from an excel file, calculates certain metrics and then stores the data in a new row in a predefined file. I want to run the code via VBA to make other people use it instead of executing the python file via the terminal bar or the command line. However, I cannot seem to get the VBA code running. I have tried xlwings, but I receive various error messages (see here: text
I habe also tried various snippets like this for instance, but none seems to open/execute the python script.
Sub RunPythonScript()
Dim shellCommand As String
Dim scriptPath As String
Dim pythonPath As String
' Set the path to your Python executable
pythonPath = "/Users/johannes/miniconda3/bin/python"
' Set the path to your Python script
scriptPath = "/Users/johannes/Desktop/VC_Project/script.py"
' Build the shell command
shellCommand = pythonPath & " " & scriptPath
' Execute the shell command
Shell (shellCommand)
MsgBox "Done"
End Sub