I see what you are trying to do, but there are easier ways to do this. Some questions to consider:
1. Is selenium
the right tool for the job?
Do you need to simulate an entire browser navigate and download the file, or can you use some code to more simply download the file? Simulating the browser seems like a good idea until you notice you can simply scrape the website.
Using something like requests
to download a webpage and something like BeautifulSoup to extract the specific link for the .xlsx
, you can perhaps more easily achieve what you are looking for.
If selenium
is indeed needed you should look into how to download the file -- not copy and paste it into Excel. Copying the file from the browser will require you to figure out some things like how to paste it on Excel, and extract individual HTML tags... which I bet will be inconceivably hard.
2. Do you wish to modify the.xlsx
file?
If not, you should simply download it to a specific directory in your computer, and open the file on Excel with Python. If yes, then you will have to look into tools like pandas
.
Don't give up.
If you looking to get this project to work you gotta keep in mind that programming is 65%-70% research and 25%-30% actually programming. The above resources should get you started, but it is vague enough that you will have to do your own research to get it going.