I have a small Python code to open an Excel file. Now I want to "Save As" with a different name but same format. How do I do that?
Just use the SaveAs
method:
import win32com.client
office = win32com.client.Dispatch("Excel.Application")
wb = office.Workbooks.Open("C:/FileName.xlsx")
wb.SaveAs(Filename="C:\\NewFileName.xlsx")
wb.Close()
office.Quit()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With