
- Python
- Automation
Incremental Spend Analysis Automation
A Python workflow using pandas and openpyxl to automate recurring Excel budget analysis.
The why
What problem was worth solving?
Estimating incremental campaign spend meant manually filtering line-item budgets, calculating budget-increase scenarios, and consolidating the results in Excel.
The goal was to automate that repetitive analysis while keeping Excel as the deliverable, since that's what business stakeholders actually open.
Success: consistent line-item and campaign-level budget scenarios, with minimal manual intervention.
The work
What did I build, and how?
A reusable Python workflow, built with pandas and openpyxl, that turns a platform budget export into incremental spend scenarios. The script:
- Imports monthly flight budgets from Excel.
- Identifies each line item's channel from its naming convention (
Disp,Vid,CTV). - Filters for Display and online video budgets in November and December.
- Accounts for a platform-specific date discrepancy affecting November budgets.
- Calculates a conservative (+25%) and an aggressive (+50%) budget scenario.
- Aggregates the results by month and channel.
- Exports a workbook with a campaign summary and line-item detail.
Technical decisions: a dictionary mapping for channel classification, pandas for filtering and aggregation, and openpyxl for Excel formatting.
The win
What worked, and how do I know?
A repeatable workflow that converts a platform export into a structured incremental budget analysis. It produces:
- A campaign-level summary by month and channel.
- A line-item budget breakout.
- Conservative and aggressive incremental spend scenarios.
- A script that needs only a campaign ID and an input file to run again.

The core calculations and the Excel export are implemented. Final formatting and validation are the remaining steps.
Impact: fewer manual analysis steps, and a reusable foundation for future incremental spend requests. Time savings haven't been measured yet.
The lesson
What did I learn?
Technical: pandas DataFrame operations, dictionary mapping, date transformations, groupby() aggregation, and Excel automation.
Debugging: how to diagnose KeyError exceptions, normalize inconsistent Excel headers, and keep source data separate from reporting transformations.
Tradeoff: a budget-increase calculator is not the same as a validated model of incremental spend capacity. This workflow models hypothetical increases; it doesn't establish whether the additional inventory can actually be bought efficiently.
Next iteration: bring in historical delivery, bid rates, win rates, and auction availability, moving from budget scenarios to evidence-based incremental spend recommendations.