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
Active
Viewed 207 times
1 Answers
3
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.

Tim Shidlovskii
- 114
- 5
-
2The [article](https://pbpython.com/windows-com.html) you provided says you need windows installed for pywin32 to work. What happens if someone uses Mac or Linux Os? I am using windows myself but am writing a program for others. – Kent Choo Jul 24 '22 at 09:52
-
@KentChoo, yes it looks like a problem for multiplatform applications. In the case of Linux OS, it's easy, there is no Excel at all:) I'm unable to answer about Mac because I do not use it. However, I hope this will be helpful: https://stackoverflow.com/questions/15164132/enumerate-all-installed-applications-on-os-x – Tim Shidlovskii Jul 24 '22 at 10:07
-