Run excel macro with Python on Linux

Viewed 1651

So I have a script that open an existing workbook, execute a macro, save and quit the workbook. It work on windows using win32com.client and I would like to do the same on linux but I cant find how to run a macro without win32com.client.

my script on windows :

import os
import win32com.client

if os.path.exists("Book1.xlsm"):
    path = os.getcwd()
    xl = win32com.client.Dispatch("Excel.Application")
    xl.Workbooks.Open(Filename=path+"\\Book1.xlsm")
    xl.Application.Run("Book1.xlsm!sheet1.color")
    xl.DisplayAlerts = False
    xl.Application.Save()
    xl.DisplayAlerts = True
    xl.Workbooks.Close()
    xl.Application.Quit()
    del xl
0 Answers
Related