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
Filling PDF Forms with Python
Fill AcroForm PDF fields from Python with pypdf — read the field tree, write text, checkbox and radio values, force appearance streams, and flatten the result.
Handling Large CSV Files with Chunking
Read multi-gigabyte CSV files in pandas without exhausting memory — chunksize loops, dtype narrowing, column selection, and when to switch to DuckDB or Polars.
Working with Excel Dates and Number Formats
Handle Excel date serials, the 1900 leap-year bug, text-that-looks-like-a-date and number format codes with pandas and openpyxl — read, write and verify them.
Building and Editing Word Tables with Python
Create and edit Word tables with python-docx — write a DataFrame to a styled table, control column widths, merge cells, add header repeats and edit existing tables.
Validating Document Data with Schemas
Put a schema between extraction and reporting — declare dtypes, ranges and uniqueness with pandera, validate records with pydantic, and quarantine what fails.
pdfplumber vs camelot vs tabula
Side-by-side comparison of pdfplumber, camelot, and tabula-py for PDF table extraction. Covers install deps, lattice vs stream, accuracy, speed, and a fallback script.
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
Fix PDF Columns Merged into One DataFrame Column
Extracted PDF rows arrive as a single column of text. Split on x-coordinates rather than whitespace, supply column separators, and validate the resulting frame.
Email Generated Reports with Python
Send generated PDF and Excel reports by email from a scheduled job — build a multipart message, attach files with the right MIME type, and handle SMTP failures.
Fix Cron Not Running a Python Script
A Python job runs from the shell and does nothing under cron. Fix the minimal environment, the missing virtualenv, relative paths and the silently discarded output.
Validating Document Data with Schemas
Put a schema between extraction and reporting — declare dtypes, ranges and uniqueness with pandera, validate records with pydantic, and quarantine what fails.
Fix pandera SchemaError Dtype Mismatch
pandera reports expected series to have type float64 got object. Find the value that blocked inference, enable coercion safely, and choose nullable dtypes.
Quarantine Invalid Rows in a Pipeline
Route failing rows to a quarantine store with their reason and provenance, alert on the reject rate, and reprocess once the source is fixed — without losing data.