How to Use Python to Automate Daily Tasks: A Step-by-Step Tutorial for Beginners

ajit guptaajit gupta
5 min read

Do you spend hours on repetitive tasks like renaming files, sending emails, or managing spreadsheets? With Python automation, you can save time and eliminate manual work by writing simple scripts.

In this guide, you’ll learn how to automate daily tasks using Python, even if you're a beginner. We'll cover real-world examples, step-by-step instructions, and useful Python libraries.

πŸ”Ή Why Automate Tasks with Python?

βœ… Saves time – Eliminate manual and repetitive work
βœ… Boosts productivity – Focus on important tasks instead of routine ones
βœ… Reduces errors – Automate tasks accurately without mistakes
βœ… Easy to learn – Python has beginner-friendly libraries for automation


πŸ”Ή Prerequisites

Before we start, make sure you have:
βœ” Python installed (Download from python.org)
βœ” A basic understanding of Python syntax
βœ” An IDE (like VS Code, PyCharm, or Jupyter Notebook)

🎨 Bonus: Enhance Your UI Design with a Free Background Remover

Utilshub’s Background Remover – Make Your UI Assets Stand Out

When designing websites or UI components, high-quality images play a crucial role. However, many designers struggle with removing backgrounds to create clean, professional visuals.

That's where Utilshub’s AI-Powered Background Remover comes in! With just one click, you can:
βœ” Remove backgrounds from im
ages instantly
βœ” Make UI components look sleek and professional
βœ” Create transparent assets for web design
βœ” Save time on manual editing

This diagram represents how Python automates tasks like file management, email sending, web scraping, and Excel processing.

          Start
            β”‚
            β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   User Input   β”‚  (Choose task: Files, Email, Web Scraping, Excel)
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Load Python    β”‚  (Run the script)
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Task Execution        β”‚  (Perform the selected automation)
   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
   β”‚ - Rename files         β”‚  
   β”‚ - Send email           β”‚  
   β”‚ - Scrape web data      β”‚  
   β”‚ - Modify Excel files   β”‚  
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Task Completed β”‚  (Save output, send confirmation)
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
          End

You can create a mind map like this:

        Python Automation
               β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚                       β”‚
 File Handling      Web Scraping
  β”‚                       β”‚
  β”œβ”€β”€ Rename Files        β”œβ”€β”€ Extract Data
  β”œβ”€β”€ Move Files          β”œβ”€β”€ Scrape Prices
  β”œβ”€β”€ Delete Files        β”œβ”€β”€ Auto-fill Forms
  β”‚                       β”‚
  β”‚                       β”‚
 Email Automation    Excel & CSV Automation
  β”‚                       β”‚
  β”œβ”€β”€ Send Emails         β”œβ”€β”€ Read & Edit Data
  β”œβ”€β”€ Bulk Emails         β”œβ”€β”€ Generate Reports
  β”œβ”€β”€ Auto-Responses      β”œβ”€β”€ Automate Data Entry

πŸ”Ή Step 1: Automate File and Folder Management

πŸ“Œ Example: Rename Multiple Files Automatically

If you have hundreds of files and need to rename them, Python can do it in seconds.

πŸ”Ή Install Required Library:

pip install os

πŸ”Ή Python Script:

import os

folder_path = "C:/Users/YourName/Documents/files"  # Change this to your folder path
for index, filename in enumerate(os.listdir(folder_path)):
    new_name = f"document_{index}.txt"  # Customize file naming pattern
    old_file = os.path.join(folder_path, filename)
    new_file = os.path.join(folder_path, new_name)
    os.rename(old_file, new_file)

print("Files renamed successfully!")

βœ… What it does?

  • Reads all files in a folder

  • Renames them with a sequential number (document_1.txt, document_2.txt, etc.)


πŸ”Ή Step 2: Automate Sending Emails with Python

πŸ“Œ Example: Send Automated Emails Using Python

You can send emails with attachments automatically using Python’s smtplib and email modules.

πŸ”Ή Install Required Libraries:

pip install smtplib email

πŸ”Ή Python Script:

import smtplib
from email.message import EmailMessage

# Email credentials
EMAIL_ADDRESS = "your_email@gmail.com"
EMAIL_PASSWORD = "your_password"

def send_email():
    msg = EmailMessage()
    msg["Subject"] = "Automated Email from Python"
    msg["From"] = EMAIL_ADDRESS
    msg["To"] = "recipient@example.com"
    msg.set_content("Hello, this is an automated email sent using Python!")

    # Send email
    with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp:
        smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
        smtp.send_message(msg)

send_email()
print("Email sent successfully!")

βœ… What it does?

  • Logs in to Gmail SMTP

  • Sends an email with a custom subject and message

  • You can modify it to send emails in bulk

πŸš€ Tip: If you're using Gmail, enable "Less Secure Apps" or use an App Password.


πŸ”Ή Step 3: Automate Web Scraping with Python

πŸ“Œ Example: Extract Data from a Website

Use Python to scrape data from websites and save it into a file.

πŸ”Ή Install Required Library:

pip install requests beautifulsoup4

πŸ”Ή Python Script:

import requests
from bs4 import BeautifulSoup

url = "https://example.com"  # Replace with the website URL
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")

# Extract all <h1> tags
headings = soup.find_all("h1")

for heading in headings:
    print(heading.text)

βœ… What it does?

  • Sends a request to a website

  • Extracts all H1 headings

  • Prints them in the terminal

πŸš€ Tip: Modify the script to scrape articles, prices, or stock market data!


πŸ”Ή Step 4: Automate Excel & CSV File Management

πŸ“Œ Example: Read and Update an Excel File

Use Python to automate data entry, calculations, and reports in Excel.

πŸ”Ή Install Required Library:

pip install openpyxl pandas

πŸ”Ή Python Script:

import pandas as pd

# Load Excel file
df = pd.read_excel("sales_data.xlsx")

# Calculate total sales
df["Total Sales"] = df["Quantity"] * df["Price"]

# Save the updated file
df.to_excel("updated_sales_data.xlsx", index=False)

print("Excel file updated successfully!")

βœ… What it does?

  • Reads an Excel file

  • Calculates Total Sales (Quantity Γ— Price)

  • Saves the updated file

πŸš€ Tip: You can automate invoices, reports, and data analysis!


πŸ”Ή Conclusion: What’s Next?

Congratulations! πŸŽ‰ You’ve learned how to use Python to automate daily tasks like:
βœ” Renaming files
βœ” Sending emails
βœ” Scraping websites
βœ” Managing Excel files

πŸš€ Want to Learn More? Try automating:

πŸ’¬ What would you like to automate with Python? Comment below and let’s discuss! πŸš€πŸ”₯

0
Subscribe to my newsletter

Read articles from ajit gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ajit gupta
ajit gupta

Hey! I'm a passionate Full-Stack Developer who loves turning ideas into scalable web apps. I specialize in NestJS, React, and MongoDB, and enjoy working on modern product experiences with clean UI and solid backend architecture. Currently exploring fintech integrations like Razorpay and PayPal. Follow me for practical coding tips, tutorials, and insights from real-world projects. Let’s build something awesome together! πŸ”₯