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

How do I create a workflow in Automator or a script in AppleScripts to download an excel file from a specific webpage?

I would like to create a workflow in Automator or a script in AppleScript (or a combination of the two), that opens Safari to a specified page and downloads an excel file from this page and saves the downloaded document to my desktop.


Is this something that be done? If so, how?


I have so far been able to build a workflow in Automator to open Safari and added an AppleScript that takes Safari to a specific page that has an Excel document.


I can't figure out where to go from here... Any help would be apprecitated.


Thanks!

iMac, OS X Mavericks (10.9.2), Automator & AppleScripts

Posted on Apr 2, 2014 9:59 AM

Reply
3 replies

Apr 2, 2014 3:52 PM in response to rccharles

the page where the document is located is always the same but the document name changes. I'm a beginner at all this and while i can get to the terminal but i dont know what:


# press return when down typing.

man curl


this indicates, or what it executes... If you could maybe further explain?


And sincerely thank you for replying.

Apr 2, 2014 5:34 PM in response to DiaKat86

Would you have the web address the excel sheet is on?

Is there a simular web page you could point to if not?


Would there be a copy of the file on an FTP page. This would be easier.


curl

http://www.cyberciti.biz/faq/mac-os-x-terminal-download-file/

http://www.thegeekstuff.com/2012/04/curl-examples/

http://curl.haxx.se/docs/manpage.html


Macintosh-HD -> Applications -> Utilities -> Terminal

# Press return to run a command.


the curl is a terminal command ( Unix ). It allows you to read a file off of the web.


man curl


provides cryptic information on the commnad curl.


press the space bar to advance a page.


press letter to q to quit.



--------------------------------------------------------------


What you may have to is to read in the web page as a text file. Go "fishing" through the page to find the excel file you need. Once you find the file, you can use curl to read the file.


curl is a very full featured command. (read complex to figure out ).



--------------------------------------------------------------


(*


It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on. Here is an example.



Author: rccharles

For testing, run in the Script Editor.

1) Click on the Event Log tab to see the output from the log statement

2) Click on Run

For running shell commands see:

http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html



*)



on run

-- Write a message into the event log.

log " --- Starting on " & ((current date) as string) & " --- "

-- debug lines

set desktopPath to (path to desktop) as string

log "desktopPath = " & desktopPath

set unixDesktopPath to POSIX path of desktopPath

log "unixDesktopPath = " & unixDesktopPath

set quotedUnixDesktopPath to quoted form of unixDesktopPath

log "quoted form is " & quotedUnixDesktopPath

try

set fromUnix to do shell script "ls -l " & quotedUnixDesktopPath

display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix

on error errMsg

log "ls -l error..." & errMsg

end try

end run

How do I create a workflow in Automator or a script in AppleScripts to download an excel file from a specific webpage?

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