Python Automation Scripts Every Business Owner Should Know
Automate12 min read·April 2, 2026·--

Python Automation Scripts Every Business Owner Should Know

You don't need to be a programmer to use these. 10 Python scripts that automate the most tedious business tasks — from sending 500 emails to scraping competitor prices.

@
@kivorablog
April 2, 2026
Share

Setting Up Python (One-Time Setup)


# Install Python (if not installed)
# Download from python.org — choose Python 3.11+

# Verify installation
python --version  # Should show 3.11+

# Install pip packages we'll use
pip install requests pandas openpyxl smtplib schedule beautifulsoup4 groq



Script 1: Send Personalised Emails From a CSV


# send_emails.py
import csv
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import time

# Configure your Gmail
GMAIL_USER     = "your@gmail.com"
GMAIL_PASSWORD = "your-app-password"  # Create App Password in Google Account settings

def send_email(to_email, subject, body):
    msg = MIMEMultipart()
    msg['From']    = GMAIL_USER
    msg['To']      = to_email
    msg['Subject'] = subject
    msg.attach(MIMEText(body, 'html'))

    with smtplib.SMTP_SSL('smtp.gmail.com', 465) as server:
        server.login(GMAIL_USER, GMAIL_PASSWORD)
        server.send_message(msg)

# Read contacts from contacts.csv
# CSV format: name,email,company
with open('contacts.csv', 'r') as f:
    reader = csv.DictReader(f)
    for i, row in enumerate(reader):
        subject = f"Quick question about {row['company']}"
        body = f"""
        <p>Hi {row['name']},</p>
        <p>Your personalised message here for {row['company']}.</p>
        <p>Best,<br>Your Name</p>
        """

        try:
            send_email(row['email'], subject, body)
            print(f"✓ Sent to {row['email']}")
        except Exception as e:
            print(f"✗ Failed for {row['email']}: {e}")

        # Wait 2 seconds between emails to avoid spam filters
        time.sleep(2)



Script 2: Generate Reports From Excel Data


# generate_report.py
import pandas as pd
from datetime import datetime

# Load your sales data Excel file
df = pd.read_excel('sales_data.xlsx')

# Clean the data
df['Date']   = pd.to_datetime(df['Date'])
df['Amount'] = pd.to_numeric(df['Amount'], errors='coerce').fillna(0)

# This week's sales
this_week = df[df['Date'] >= pd.Timestamp.now() - pd.Timedelta(days=7)]

# Generate report
report = {
    'Total Revenue':   df['Amount'].sum(),
    'This Week':       this_week['Amount'].sum(),
    'Total Orders':    len(df),
    'Average Order':   df['Amount'].mean(),
    'Top Product':     df.groupby('Product')['Amount'].sum().idxmax(),
    'Top Customer':    df.groupby('Customer')['Amount'].sum().idxmax(),
},

print("\n📊 BUSINESS REPORT")
print("=" * 40)
for key, value in report.items():
    if isinstance(value, float):
        print(f"{key}: ₦{value:,.2f}")
    else:
        print(f"{key}: {value}")

# Save to Excel
report_df = pd.DataFrame([report])
report_df.to_excel(f"report_{datetime.now().strftime('%Y-%m-%d')}.xlsx", index=False)
print("\n✓ Report saved to Excel")



Script 3: Monitor Competitor Prices


# price_monitor.py
import requests
from bs4 import BeautifulSoup
import json
from datetime import datetime

PRODUCTS_TO_TRACK = [
    {
        'name':     'iPhone 15 Pro',
        'url':      'https://competitor-site.com/iphone-15-pro',
        'selector': '.product-price',  # CSS selector for price element
    },
    # Add more products
]

def get_price(url, selector):
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}
    response = requests.get(url, headers=headers, timeout=10)
    soup     = BeautifulSoup(response.content, 'html.parser')
    element  = soup.select_one(selector)
    return element.text.strip() if element else 'Not found'

results = []
for product in PRODUCTS_TO_TRACK:
    try:
        price = get_price(product['url'], product['selector'])
        results.append({
            'product':   product['name'],
            'price':     price,
            'timestamp': datetime.now().isoformat(),
            'url':       product['url']
        })
        print(f"✓ {product['name']}: {price}")
    except Exception as e:
        print(f"✗ {product['name']}: {e}")

# Save results
with open('prices.json', 'w') as f:
    json.dump(results, f, indent=2)



Script 4: Schedule Any Script to Run Automatically


# scheduler.py
import schedule
import time

def daily_report():
    print("Running daily report...")
    # Import and run your report script
    exec(open('generate_report.py').read())

def weekly_email():
    print("Sending weekly emails...")
    exec(open('send_emails.py').read())

# Schedule the tasks
schedule.every().day.at("09:00").do(daily_report)      # Every day at 9am
schedule.every().monday.at("08:00").do(weekly_email)   # Every Monday at 8am

print("Scheduler running. Press Ctrl+C to stop.")
while True:
    schedule.run_pending()
    time.sleep(60)  # Check every minute

Run this script in the background on your computer or a cheap VPS and your automations run automatically.

Read more on Kivora Blog

Read more on Kivora Blog

Get started →