简体   繁体   中英

Automating File Download of a link that looks like this: https://www.domain.com/TableData/TableA.csv

I am trying to write an application that will download .csv and .xls files and save them into a folder that will be accessed later by a VBA macro. I am posting this question after the unsuccessful use of the solution in the following link: How do i download a file using VBA (Without internet explorer)

The macro runs successfully, but the downloaded .csv file only contains the html from the login page. I find that strange because when I copy and paste the link directly into the browser without logging in, I am immediately prompted with a save, open, close window for the file.

As much as possible I am trying to avoid using SendKeys, but I can't seem to find another solution that works. I am not opposed to options other than VBA. Any help would be appreciated, thank you.

Your browser stores cookies which likely allows you to login automatically. Try browsing the page in different tabs in an incognito browser and you'll likely have to login each time.

You'll have to find a way to make the same requests your browser is sending to login, and use the cookies stored to make the requests to download the files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM