# Cloud Deploying a Scheduled Task

### cross-posted on the Wolfram Community forum

I am trying to deploy a ScheduledTask that monitors the state of a google spread sheet every hour. I want the object to display the content (which should be static), but instead upon deployment, it creates an object which redirects me to a notepad in my Wolfram Development Platform account that allows me to add information (but cannot execute). Here is a look at my code:

This imports the contents of the google doc:

Clear@url
Clear@csv
(url = "https://path-to-google-doc/export?format=csv") //
Import[#, "CSV", CharacterEncoding -> "UTF8"] & //
Flatten@# & //
(csv = #) & //
Dataset@# &


Which results in an output that takes the form: Dataset[{....}].

To create the ScheduledTask, I have tried:

Clear@obj
obj = ScheduledTask[{Now, csv}, "Hourly"](*creates a scheduled task that monitors the information in the doc every hour*)//
CloudDeploy[#, Permissions -> "Public"] &


Again, this results in a redirect to my development platform account (that is only accessible to me and not anyone else) and not to a static web object which displays the contents of the google doc. I am pretty new to using the Wolfram Cloud, but it feels a lot like a black box, which makes debugging pretty difficult because I am never sure where the issue truly lies; my thought is to wrap the scheduled task in an APIFunction, but I am not sure how to go about doing that, since there is no specific association I am looking to make for the information in the csv file. Is this the right way to go about this? How can I utilize APIFunction if I don't have an explicit set of rules I am looking to make?

Update: I've tried including the line of code before CloudDeploy of RunScheduledTask[#]& as well as StartScheduledTask[#]&. When deployed, this results in a static web object like I'd wanted, but the former gives me this, and the latter gives me this. Again, I don't like that I can't really see what's going on in the Cloud that results in it failing.

• To run a scheduled task you will apparently need a $100/month Producer account. I'd guess that there isn't anyone answering questions on StackExchange who has access to such an account. On the other hand, a Producer account comes with both email and phone Wolfram support. Jul 15, 2016 at 19:20 • @ChristopherHaydock Good point, and one that I hadn't realized. I always like to ask the community first before emailing directly, you never know if your solution can help someone else later on; do you think I'd have a better chance of this being addressed in the Wolfram Community forums? Jul 15, 2016 at 19:46 • Yes, your solution certainly will be of interest to all Wolfram Development Platform users, especially because it helps to establish the case for upgrading to a Producer account verses using an external service. See also this advice about cross-posting. Jul 15, 2016 at 20:08 ## 1 Answer I am not sure how many of y'all have been keeping up with the Community discussion, but there are some key updates I wanted to summarize here: 1. ScheduledTask does not store values; it is essentially a block of code that produces a result which it then discards. AutoRefreshed works better wrt deployment of tasks to the Wolfram Cloud because AutoRefreshed objects will store a value and repeatedly update it according to the given schedule. 2. Functions like RunScheduledTask and StartScheduledTask do not perform on Cloud objects like you would expect them to, and will likely be deprecated. (Personally, as a result of the current technical discussion, I also think that the added flexibility of AutoRefreshed will result in it becoming the de facto function in place of ScheduledTask). 3. GenerateHTTPResponse is a good function to use if you are unable/do not want to CloudDeploy, but would like to see if it is at least possible, because it simulates the behavior of the Wolfram Cloud server • Wolfram Development Platform pricing lists scheduled tasks, which presumably include AutoRefreshed, at the$100/month Producer price point. Have you upgraded your account to this level? Jul 22, 2016 at 18:15
• @ChristopherHaydock yes, the company I work for uses their own Private Cloud, so we should have all these features I am trying to make use of Jul 22, 2016 at 18:53
• OK great! Are you working with Wolfram support on a solution to the AuotRefreshed problem that you mention in your most recent Wolfram Community post? Jul 22, 2016 at 19:59
• @ChristopherHaydock yes, I am! The solution that support suggested is very similar to the piece of code that Dylan posted, which acts as a nice template to get started with. Jul 22, 2016 at 22:03
• After you get something working I assume that you will post your code on the Wolfram Community, where I agree with Andrew de Laix that even big fans of Postfix notation and pure functions should eliminate the Postfix and keep the number of pure functions to an absolute minimum. I look forward to reading about your solution! Jul 22, 2016 at 22:36