Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Download files listed as URLs in a spreadsheet?

Trying to develop an applescript, macros, or something else that sources (100+) URLs listed in an excel column that link to PDFs online and then download these onto a new local folder on the desktop using the cell to the right of the URL column to provide the filename?


One more wrinkle is that the website requires username and password authentication to view the files.

Another wrinkle is the URLs all use https


Thank you for your assistance.


-Danny

Posted on Feb 23, 2017 3:51 PM

Reply
7 replies

Feb 23, 2017 4:59 PM in response to DMarx81

This Applescript will read the current Excel Worksheet (with the URL in Col A and the name of PDF in Col B) and d/l to the Desktop.


tell application "Microsoft Excel"

tell active sheet

tell used range

set rc to count of rows

end tell

set theList to get value of range ("A1:B" & rc) as list

repeat with theItem in theList

do shell script "curl " & item 1 of theItem & " -o $HOME/Desktop/" & item 2 of theItem

end repeat

end tell

end tell

This does not handle username and password authentication, but can easily be added to the curl command.

Take a look at: man curl There's options to deal with passwords. Googling curl password can also give some help on dealing with passwords (see; http://stackoverflow.com/questions/2594880/using-curl-with-a-username-and-passwo rd) (but you need to be careful in sending passwords in the clear).


So, changing:

do shell script "curl " & item 1 of theItem & " -o $HOME/Desktop/" & item 2 of theItem

to:

do shell script "curl -u username:password " & item 1 of theItem & " -o $HOME/Desktop/" & item 2 of theItem


(but see warnings re: username and password in man curl)

Download files listed as URLs in a spreadsheet?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.