So this would be one way to do it:
Option Explicit
Sub RunPythonScript()
Dim objShell As Object
Dim PythonExe, PythonScript As String
Set objShell = VBA.CreateObject("Wscript.Shell")
PythonExe = """C:Program Files (x86)Microsoft Visual
StudioSharedPython37_64python.exe"""
PythonScript = """E:My DocumentsFinanceEconomyexcel6.py"""
objShell.Run PythonExe & PythonScript
End Sub
And on Python
import xlwings as xw
book.sheets["Sheet1"].range('A1').value = 100
Now one can add a button in the excel sheet and call the python script to populate the excel.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…