Here is the process to automate or schedule running of Python script or a Jupyter notebook using Task Scheduler
Task scheduler is for windows only, for linux and Mac you can try https://snapcraft.io/mkcron and https://apple.stackexchange.com/questions/4714/os-x-is-there-a-built-in-scheduler-program.
This will work for both python script and a Jupyter notebook.
In case of Jupyter notebook first convert it into a python script by going to file then download as python file.
Now open Task scheduler and click on Task Scheduler Library.
- Then on the right menu click on create task.
2. Then give the task a name as description
You will need to have certain locations before moving forward
- Location of installation of python interpreter : type where python in cmd to get the location
- Location of the python script
Goto Action section of the task scheduler, here we will tell the task scheduler what to do, click on new
- Inside the Program/script box paste the location of python interpreter
- Inside Start in: add the location where the python file is
- And finally inside the Add Arguments box paste the name of the python file
- press ok
Now go to the Triggers section and click new, we will set the schedule for which the program should run
- Select Weekly or daily or monthy depending on your requiments
- Select the time when the script should start
- optional set the expiration date
In my case I chose the script to run on every Monday, Tuesday, Wednesday and Friday at 8 hours, with no expiration date
The new task will be created and status will tell if its ready or not, and the next run time will shown.
To make your task a bit more better you can add a code to show notification at the end of execution.
You can also add several print statements inside the python script file to see your progress when the script is executed.