I am using python 3.9.7. I would like to ask if there is a way python can determine if Excel is installed and also return the version number of Excel if Excel is installed.
CodePudding user response:
You can use ProgID to determine this:
import win32com.client
try:
excel = win32com.client.Dispatch("Excel.Application")
version = excel.version
print("Excel version:", version)
except:
print("There are no excel installed")
There is Office 365 installed on my PC, and I get this output:
Excel version: 16.0
I also recommend you to read this article.