Python automation for real office workflows
Python Doc & Data Automation
Replace repetitive document and data chores with practical scripts, reusable patterns, and production-minded walkthroughs.
Start here
Redacting Sensitive Data in PDFs with Python
Permanently redact names, account numbers and IDs from PDFs with PyMuPDF — search, apply, scrub metadata, handle scans, and verify nothing is recoverable.
Watching Folders for Incoming Documents with Python
Trigger document processing when files land in a folder — watchdog events, waiting for complete files, network shares, a work queue, startup catch-up, and exactly-once handling.
Comparing and Reconciling Spreadsheets with Python
Compare two versions of a spreadsheet or reconcile two systems' exports with pandas — normalised keys, added, removed and changed rows, tolerances, match rules and an exception report.
Find and Replace Text in Word Documents with Python
Replace text in .docx files with python-docx without losing formatting — matches split across runs, headers, footers, tables, text boxes, regex patterns, and batch updates with verification.
Extracting Text and Metadata from PDFs with Python
Extract clean reading-order text, document metadata, XMP, bookmarks and page labels from PDFs with PyMuPDF and pypdf — with column handling and quality checks.
Processing Email Attachments Automatically with Python
Pull PDF, Excel and CSV attachments from a mailbox with IMAP or Microsoft Graph, save them safely, process each message exactly once, and hand files to your document pipeline.
Building Pivot Tables and Summaries for Excel with pandas
Turn transaction data into Excel-ready pivot tables and summary sheets with pandas — pivot_table, totals, stable row and column sets, clean headers, and refreshable native pivots.
Extracting Data from Word Documents with Python
Pull paragraphs, tables, form fields, headers, text boxes and comments out of .docx files with python-docx and lxml — in document order, with merged cells and nested content handled.
Compressing and Optimizing PDFs with Python
Shrink PDFs in Python by measuring what takes space, then downsampling images, subsetting fonts, removing duplicates and linearising — without breaking text or forms.
Browse by topic
Automating Document & Data Pipelines
Wire PDF extraction, pandas transformation, and Excel/Word/PDF generation into one scheduled, logged, idempotent Python pipeline that runs unattended end to end.
Automating PDF Extraction & Generation
End-to-end Python architecture for extracting tables and text from PDFs, transforming the data, consolidating multi-file inputs, and generating reports at scale.
Python for Excel & CSV Data Processing
Replace manual spreadsheet workflows with reliable Python automation. Covers pandas, openpyxl, xlsxwriter, the csv module, and BI-ready export pipelines.
Word Document Templating & Batch Processing
Generate hundreds of consistent Word documents from CSV, Excel, or JSON with Python. Covers docxtpl, python-docx, Jinja2, batch loops, PDF export, and production hardening.
Fresh guides
Automating Document & Data Pipelines
Wire PDF extraction, pandas transformation, and Excel/Word/PDF generation into one scheduled, logged, idempotent Python pipeline that runs unattended end to end.
Combine Tables from Many PDFs into One DataFrame
Concatenating tables from hundreds of PDFs produces duplicated headers, misaligned columns and no way to trace a row back. Align schemas, tag provenance, and fail on drift.
Fix: PDF Numbers Parsed as Strings in pandas
Amounts extracted from a PDF sum to nothing because thousands separators, currency symbols, parenthesised negatives and non-breaking spaces make every column an object dtype.
Build HTML Reports with Jinja2 Templates
Turn a pipeline run into a self-contained HTML report — escape user data safely, embed charts as data URIs, and produce a file that prints to PDF without a web server.
Create PowerPoint Slides from Pipeline Data
Build a monthly deck with python-pptx — use the template's own layouts and placeholders instead of absolute positions, so slides match the brand and survive a template update.
Email Reports Automatically with Python
Send a pipeline report by email from a scheduled job — build a multipart message with an HTML body and attachments, handle SMTP auth and size limits, and never send twice.