- 1 year ago
Run .XLSX file from the Python script without waiting for completion, Windows 10
Comment
1 / 1
To run an .xlsx file from a Python script on Windows 10 without waiting for completion, you can use the subprocess
module. Here's an example code snippet:
pythonimport subprocess
filepath = 'path/to/your/file.xlsx'
subprocess.Popen(['start', filepath], shell=True)
The Popen
function in the subprocess
module allows you to start a new process. The start
command is a Windows shell command that opens a file in its associated application.
By using shell=True
, you can pass the start
command as a string, which is then executed in a new command shell.
This code will open the .xlsx file in its associated application (typically Excel) without waiting for it to finish. Note that if the file cannot be opened in the associated application, this method will not work.