3

I am trying to find a way to convert many files from .xlsx to .xls and have been trying Python with the win32com.client module:

import win32com.client
xl = win32com.client.Dispatch("Excel.Application")
wb = xl.Workbooks.Open(r"C:\Users\Kathleen\Desktop\Exp 1_1\A 1-1-1c.xlsx")
wb.SaveAs(r"C:\Users\Kathleen\Desktop\Exp 1_1\A 1-1-1c.xls", FileFormat = 56)
wb.Close()
xl.Quit()

I have no error message but the converted file does not show up in the folder I have it set up for. Not sure what I am doing wrong.

I have Windows 7, 64 bit and have downloaded: Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32

Thanks!

K. Brannen
  • 145
  • 1
  • 11

1 Answers1

1

I am not sure what is wrong, your code works for me. I used a sample file and tested it, it works. Maybe try inserting print("Checking") and input() before and after the SaveAs command to check whether the save as command is executed or not.

vinu91
  • 23
  • 3