Jump to content

Automating My Workflow With Python

From JOHNWICK
Revision as of 11:20, 13 December 2025 by PC (talk | contribs) (Created page with "How I built tools that quietly handle the boring stuff so I can focus on real problems 500px I’ve tried a bunch of VPNs, but this one really stands out. It lets me: ✔ Stream Netflix, YouTube & live sports from anywhere
✔ Stay 100% private — no tracking, no spying
✔ Protect all your devices at once + 1TB cloud storage
✔ Ultra-fast servers for lag-free streaming & browsing
✔ Secure banking & on...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How I built tools that quietly handle the boring stuff so I can focus on real problems

I’ve tried a bunch of VPNs, but this one really stands out. It lets me: ✔ Stream Netflix, YouTube & live sports from anywhere
✔ Stay 100% private — no tracking, no spying
✔ Protect all your devices at once + 1TB cloud storage
✔ Ultra-fast servers for lag-free streaming & browsing
✔ Secure banking & online payments anywhere
✔ Bypass restrictions & access content your country blocks
✔ Unlock a hidden 70%+ discount — massive savings you won’t get elsewhere Honestly, it’s the best VPN I’ve used so far. ⚡ 14M+ users are already using it worldwide. 👉 Get NordVPN with 70%+ OFF + 3 Free Month


When I first started coding, I wasted hours on repetitive tasks: renaming files, cleaning data, writing boilerplate reports. Over time, I discovered that Python could do most of this for me. The more I automated, the more I realized — automation isn’t just about efficiency. It’s about freeing up brainpower for harder problems.

In this article, I’ll walk through the automation systems I’ve built with Python. Each section will show code, tools, and the deeper principles behind making Python do the heavy lifting.


1. Automating File Renaming With os and pathlib Every company I’ve worked with had some form of “file naming mess.” Python fixes that in minutes.

import os
from pathlib import Path

directory = Path("C:/reports/")

for i, file in enumerate(directory.iterdir(), start=1):
    if file.is_file():
        new_name = directory / f"report_{i}{file.suffix}"
        file.rename(new_name)
        print(f"Renamed {file} -> {new_name}")

Instead of wasting time renaming 200 files manually, you let Python do it in seconds.


2. Cleaning CSVs With pandas Messy CSVs are a fact of life. Luckily, pandas makes data cleaning almost effortless.

import pandas as pd

df = pd.read_csv("sales.csv")

# clean column names
df.columns = [col.strip().lower().replace(" ", "_") for col in df.columns]

# fill missing values
df["revenue"] = df["revenue"].fillna(0)

# remove duplicates
df = df.drop_duplicates()

df.to_csv("clean_sales.csv", index=False)

This script takes a nightmare spreadsheet and makes it analysis-ready.


3. Generating Automated Reports Instead of copy-pasting numbers into slides, I let Python generate reports with matplotlib and jinja2.

import pandas as pd
import matplotlib.pyplot as plt
from jinja2 import Template

df = pd.read_csv("clean_sales.csv")

plt.plot(df["date"], df["revenue"])
plt.savefig("plot.png")

template = Template("""
<h1>Sales Report</h1>
<p>Total Revenue: {{ total }}</p>
<img src="plot.png">
""")

html_report = template.render(total=df["revenue"].sum())

with open("report.html", "w") as f:
    f.write(html_report)

That’s a full data report with visualization — done automatically.


4. Automating Emails With smtplib Reports are useless unless they’re shared. Python can email them automatically.

import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["Subject"] = "Weekly Sales Report"
msg["From"] = "[email protected]"
msg["To"] = "[email protected]"
msg.set_content("See attached report.")
msg.add_attachment(open("report.html", "rb").read(),
                   maintype="text", subtype="html", filename="report.html")

with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp:
    smtp.login("[email protected]", "password")
    smtp.send_message(msg)

Now the whole team gets updates without me lifting a finger.


5. Automating Browser Tasks With selenium Some tasks can’t be done via APIs, but Python can drive the browser.

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("https://example.com/login")

driver.find_element(By.ID, "username").send_keys("my_username")
driver.find_element(By.ID, "password").send_keys("my_password")
driver.find_element(By.ID, "login-btn").click()

Whether it’s scraping data or automating form submissions, selenium is the Swiss army knife for browser automation.


6. Scheduling Everything With schedule Automation is only useful if it runs without you.

import schedule
import time

def job():
    print("Running weekly automation...")

schedule.every().monday.at("09:00").do(job)

while True:
    schedule.run_pending()
    time.sleep(1)

Now scripts execute themselves at the right time — no manual triggers needed.


7. Organizing PDFs With PyPDF2 Messy PDFs? Python can merge, split, and reorganize them.

from PyPDF2 import PdfMerger

merger = PdfMerger()
merger.append("report1.pdf")
merger.append("report2.pdf")
merger.write("merged_report.pdf")
merger.close()

Instead of clicking through Adobe menus, this runs in one command.


8. Scaling Automations With fastapi When coworkers kept asking me for the same scripts, I turned them into APIs.

from fastapi import FastAPI

app = FastAPI()

@app.get("/clean-data")
def clean_data():
    return {"status": "success", "message": "Data cleaned!"}

Now anyone in the company can trigger my automation with a simple API call.


Wrapping Up Python is the closest thing I’ve found to a workplace superpower. The libraries I’ve shown — os, pandas, matplotlib, jinja2, smtplib, selenium, schedule, PyPDF2, and fastapi—are all simple, but together they turn manual drudgery into automated workflows. Automation doesn’t just save time. It creates space for deeper, creative work. And once you taste that freedom, you never want to go back.

Read the full article here: https://medium.com/codetodeploy/automating-my-workflow-with-python-f81ae46ae14b