Python Central HubSign in

Automation and Scripting

Python Automation and Scripting

Use Python to automate your OS, office tasks, web workflows, communication, GUIs, and scheduled jobs.

What you’ll learn

This section teaches Python as a tool:

  • automate files and folders
  • generate reports from spreadsheets and PDFs
  • scrape and automate websites
  • send notifications (email, bots, webhooks)
  • control your desktop (carefully)
  • schedule automations and deploy them

Who this is for

You’ll enjoy this module if you already know:

  • basic Python syntax
  • loops, functions
  • reading/writing files

How the course is organised

The module has six phases, and each one builds on the one before.

  1. OS and file system. os, pathlib, shutil, glob, archives, and watching folders. Everything else depends on these, because almost every automation reads or writes files.
  2. Office and productivity. CSV, Excel, Word, PDF, Google Sheets, and report generation. This is where automation saves the most time in a typical job.
  3. Web automation and scraping. requests, BeautifulSoup, Selenium, waits, and the ethics of scraping.
  4. Communication. Email, Outlook, SMS, Slack, Discord, and Telegram, so your scripts can tell you when they finish or fail.
  5. GUI and system control. pyautogui for mouse and keyboard. It is the last resort when no API or library exists.
  6. Scheduling and deployment. Command-line arguments, logging, error handling, cron, Windows Task Scheduler, and the schedule library.

How to use these pages

Most scripts here touch things outside Python: your files, your inbox, your mouse, other people's servers. So a few habits apply to every lesson.

  • Run every script first on a throwaway folder or test account.
  • Read the code before running it, and change the paths to match your machine.
  • Prefer a library or an official API over simulating clicks. Clicking is fragile.
  • Add logging early, so an unattended script leaves a record of what it did.

Some pages need packages that are not in the standard library, such as openpyxl, selenium, or pyautogui. Install them in a virtual environment (python -m venv .venv) so they stay separate from your other projects. The exercises at the end of each page use only the standard library, so they run in the browser.

Safety first

Automation can be dangerous.

Before running scripts that delete/move files or click UI buttons:

  • test on a dummy folder
  • use dry runs (print actions first)
  • keep backups

Start with the Safety Warning page.

Check your understanding

quizCheck yourself
  1. What is the safest first step before running a script that moves or deletes files?

    Show answer

    B — Run it on a dummy folder, in dry-run mode, with a backup of anything that matters — A dummy folder and a dry run show you what the script would do before it can do any damage, and a backup covers the case where it still gets something wrong.

  2. You need data from a website that offers an official API. Which approach should you prefer?

    Show answer

    C — Use the API, because it is stable and meant for programs — APIs return structured data and stay stable. Scraping breaks when the page layout changes, and simulated clicks break when the screen changes.

  3. Why do the lessons recommend a virtual environment for packages such as openpyxl or selenium?

    Show answer

    B — It keeps each project's dependencies separate so versions do not clash — A virtual environment gives each project its own package versions. Nothing in Python forces you to use one, but it prevents version conflicts between projects.

Was this page helpful?

Let us know how we did