I am exporting excel documents out of another program and need to rename them under a different name, I have gotten to the point where I can pull the open excel workbook into my code, as you can see below, but I can't figure out how to rename the workbook to foo.xlxs going this route. What is my most optimal way to attack this?
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Visible=1
name = xlApp.ActiveWorkbook.Name
print(name)
Output:
activeworkbook.xlsx