How many times have you created a virtual environment and installed 500MB of pandas, openpyxl, and heavy dependencies just to merge three CSV files or rename a batch of invoices?
For enterprise environments, locked-down corporate laptops, or minimal Docker containers, installing third-party packages is often slow, restricted by IT security, or simply unnecessary.
Over the past few weeks, I decided to build a clean suite of 15 production-ready automation scripts using ONLY the Python Standard Library (zero pip install, zero third-party dependencies).
Here is what I built, how some of the most useful ones work, and where you can grab the full open-source repo.
🛠️ The Architecture: Pure Standard Library
Python's built-in standard library (csv, pathlib, urllib, re, hashlib, json, collections) is criminally underrated. When used properly, it runs at near C-speed and works out of the box on Windows, macOS, and Linux without ever touching pip.
Here are 4 standout utilities from the collection:
1. Zero-Dependency Batch CSV/TSV Merger with Auto-Header Alignment
One of the most annoying office chores is merging multiple exported CSVs where columns might be in different orders or have extra fields.
Instead of pulling in Pandas, you can achieve safe header alignment using csv.DictReader and csv.DictWriter:
import csv
from pathlib import Path
def merge_csv_files(input_dir: str, output_file: str):
folder = Path(input_dir)
files = list(folder.glob("*.csv"))
if not files:
print("No CSV files found.")
return
# Pass 1: Collect union of all headers across all files
all_headers = set()
for f in files:
with open(f, mode="r", encoding="utf-8-sig") as fp:
reader = csv.reader(fp)
try:
headers = next(reader)
all_headers.update(h.strip() for h in headers)
except StopIteration:
continue
sorted_headers = sorted(list(all_headers))
# Pass 2: Stream-write all rows aligned to global headers
with open(output_file, mode="w", encoding="utf-8-sig", newline="") as out_fp:
writer = csv.DictWriter(out_fp, fieldnames=sorted_headers, extrasaction="ignore")
writer.writeheader()
total_rows = 0
for f in files:
with open(f, mode="r", encoding="utf-8-sig") as in_fp:
reader = csv.DictReader(in_fp)
for row in reader:
writer.writerow(row)
total_rows += 1
print(f"Successfully merged {len(files)} files ({total_rows} rows) into {output_file}")
2. In-Memory VLOOKUP / Table Matcher (Hash Join)
Need to join a master pricing sheet with an inventory report without launching Excel? A hash table lookup in pure Python completes 100,000 rows in less than 200ms:
import csv
def vlookup_merge(file_a, file_b, key_col, merge_col, output_file):
# Build hash map from File B
lookup_map = {}
with open(file_b, "r", encoding="utf-8-sig") as f:
reader = csv.DictReader(f)
for row in reader:
k = row.get(key_col, "").strip()
if k:
lookup_map[k] = row.get(merge_col, "")
# Stream through File A and inject matched column
with open(file_a, "r", encoding="utf-8-sig") as in_f, open(output_file, "w", encoding="utf-8-sig", newline="") as out_f:
reader = csv.DictReader(in_f)
fieldnames = reader.fieldnames + [merge_col]
writer = csv.DictWriter(out_f, fieldnames=fieldnames)
writer.writeheader()
for row in reader:
k = row.get(key_col, "").strip()
row[merge_col] = lookup_map.get(k, "N/A")
writer.writerow(row)
3. Chunked MD5 Duplicate File Finder
Find identical files across nested directories without loading massive files into RAM:
import hashlib
from pathlib import Path
def hash_file_chunked(filepath: Path, chunk_size=65536) -> str:
hasher = hashlib.md5()
with open(filepath, "rb") as f:
while chunk := f.read(chunk_size):
hasher.update(chunk)
return hasher.hexdigest()
def find_duplicates(target_dir: str):
seen_hashes = {}
duplicates = []
for path in Path(target_dir).rglob("*"):
if path.is_file():
file_hash = hash_file_chunked(path)
if file_hash in seen_hashes:
duplicates.append((path, seen_hashes[file_hash]))
else:
seen_hashes[file_hash] = path
return duplicates
📦 What's Included in the Open-Source Repo
The repository includes 15 standalone tools:
-
01_batch_excel_merger.py: Merge 100+ CSV/TSV with dynamic header alignment. -
02_extract_emails_and_phones.py: High-speed regex extraction from raw dumps. -
03_bulk_file_renamer.py: Regex and sequential file renamer. -
04_split_large_csv.py: Split giant files by row count or memory limit. -
05_json_to_excel.py: Flatten nested JSON logs into tabular CSV. -
06_clean_dirty_text.py: Unicode normalization, whitespace trimming, BOM cleaning. -
07_simple_web_scraper.py: Standard library HTML parser & HTTP client. -
08_auto_folder_organizer.py: Smart directory organizer by extension and date. -
09_vlookup_matcher.py: In-memory hash-join between CSV files. -
10_image_batch_resizer.py: Batch image dimensions & compression. -
11_website_health_checker.py: Concurrent status code & latency monitor. -
12_pdf_page_extractor.py: Standard library PDF page splitting. -
13_find_duplicate_files.py: MD5 chunked duplicate file detector. -
14_auto_csv_profiler.py: Generate instant data quality summaries. -
15_batch_text_replacer.py: Search and replace across codebases & markdown docs.
🔗 Get the Code & Free Resources
All 15 scripts are completely open-sourced under the MIT license on GitHub:
⭐ GitHub Repo: cloudhao237/awesome-python-office-automation
If you find it useful, please feel free to leave a star on the repo!
Additional Free Download
I also put together a comprehensive 2026 AI Productivity & Prompt Cheat Sheet for developers and office professionals. You can grab it for free ($0) on Gumroad:
🎁 Download the Free AI Productivity Cheat Sheet
Or check out the 100+ Extended Automation Scripts Bundle if you want an expanded library for custom enterprise tasks.
What's your most tedious daily chore?
What repetitive tasks in your day-to-day workflow do you wish you had a quick 20-line script for? Drop a comment below and I'll add the most requested ones to the repo!
Top comments (0)