Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Python to launch Excel file

when i try os.system("open " + 'myfile.xlsx')
i get the output '0'

similarly, trying
os.system("start excel.exe myfilepath")
gives the result 32512

I have imported os and system, and I'm on mac. How can I change this so it does actually launch that excel file? And out of curiosity, what do the numbers it prints out mean?

Thanks!

like image 347
C2P1 Avatar asked Mar 11 '16 12:03

C2P1


People also ask

Can Python access Excel files?

Using xlrd module, one can retrieve information from a spreadsheet. For example, reading, writing or modifying the data can be done in Python.


1 Answers

Just these two lines

import os
os.system("start EXCEL.EXE file.xlsx")

Provided that file.xlsx is in the current directory.

like image 72
Ahmed Adewale Avatar answered Nov 06 '22 06:11

Ahmed Adewale