Answer the question
In order to leave comments, you need to log in
Automatically execute "Save As" in Excel using Python?
Hello!
The next backstory has come. Now I am preparing the data for processing and some of the parsed excels are actually *.mhtml files. Being saved in *.xls format, they open as MS Excel 97-2003 workbooks, but other tools (Power Query, xlrd, pyexcel packages) do not recognize them as Excel. I noticed that if you go into a similar file and save it as a *.xlsx file, then the problem with the format is solved. However, 3240 such files have accumulated, and the manual processing of this bunch will be the last thing I remember during my summer vacation.
I posted an example of a file at the link:
Click on Yandex disk
And here's the question - how to implement automatic execution of the chain of actions "Open file ==> Save as ... in *.xlsx format ==> Close file" in Python?
And is such a solution to the problem optimal - maybe there are simpler alternatives how to bring the state of the files to the correct format?
Answer the question
In order to leave comments, you need to log in
I think a VBA script can handle this, opening all the files in a specific folder, and then saving them. You can do it through the For each loop, the logic is as follows: for each book located at address X, open it, and then save it as in the desired format at address Y. In this way, I combine about 1000 books into one weekly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question