Use python to detect Excel installation

Question:

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.

Asked By: Kent Choo

||

Answers:

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.

Answered By: Tim Shidlovskii
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.