Search code examples
pythonexcelwin32comxlrdxlwt

How do I open Excel Application using xlrd or xlwt?


I know I can open MS Excel application using win32com by setting Visible to true Can I use xlrd or xlwt do the same?


Solution

  • xlrd and xlwt are both libraries for reading Excel's files (that is, the storage format) - they have no connection to the actual Excel executable or libraries (they don't even require that Excel is installable on the system in question (I'm using them, for example on a CentOS machine).

    If you simply want to lauch Excel you can use subprocess:

    # Note, your path probably differs
    subprocess.call(r"C:\Program Files\Microsoft Office\Office12\EXCEL.exe")
    
    # The script will wait until Excel is closed and then continue