I have a script that automatically downloads excel files from a website using selenium.
What I want to do is create 1 big master file. I located the file by doing
list_of_files = glob.glob(r"C:\Users\Raymond.van.Zonnevel\*********\*")
latest_file = max(list_of_files, key=os.path.getctime)
Then I want to open the file. But this results in an error
Temp_df = pd.read_excel(str(latest_file))
XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'<html xm'
I think this has something to do with the fact that I download the files using selenium.
What I ultimately want to do is:
- download the file --> Done
- locate the file --> Done
- open the file --> this is where I get my error
- take the 3rd row and paste in a master file
- delete the old file and repeat for all next downloads (in for loop)
How would I go about opening and using the downloaded files?