Kundan
Kundan

Reputation: 590

How do I open an an excel file in Microsoft Excel by runnning a command in python?

I want to open an excel file in Microsoft excel, and I don't want to do it using a mouse click but rather a python code. How can I do it?

Upvotes: 0

Views: 79

Answers (1)

Equinox
Equinox

Reputation: 6748

You can use os.startfile

import os, subprocess
os.startfile(r'filepath') #For windows only
subprocess.call(['open', 'filepath']) #For MAC only

Upvotes: 2

Related Questions