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.

186 guides across 4 tracks — from first extraction to scheduled, validated pipelines.

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

Fresh guides