I have an Excel sheet with PowerQuery connecting via ODBC to SAP Data Source.
Usually, I manually click "Refresh All" to refresh data. To automate this, I wrote a Python script to refresh the sheet automatically. It has some issues.
Is there a way to execute this Refresh All command from command line?
Code tried in Python:
xlapp = win32com.client.DispatchEx("Excel.Application")
wb = xlapp.workbooks.open(File1.xlsx)
wb.RefreshAll()
wb.SaveAs(File2.xlsx)
ActiveWorkbook.RefreshAll. Are you using xlwings in python?import xlwings as xwapp = xw.App()wb = xw.Book('pathtoFile')wb.api.RefreshAll()