Automating Rail Fuel Surcharge Collection: How Web Scraping and Alteryx Drive Efficiency
- Mike Wohlfarth
- Mar 13
- 4 min read
Updated: Mar 17

Rail fuel surcharges are like a moving target—constantly changing, wildly inconsistent across carriers, and often buried in websites or PDFs that require extra effort to decode. For companies managing freight costs, contract negotiations, and profitability, keeping up with these charges can feel like a never-ending game of hide-and-seek. Some carriers post updates on their websites, others bury them in PDFs, and a few even require additional calculations based on fuel price indices—just to keep things interesting.
At Opportune, we believe in working smarter, not harder when it comes to business intelligence. We help companies automate tedious processes, eliminate inefficiencies, and turn scattered data into meaningful insights. Recently, we built a fully automated fuel surcharge tracking process that scrapes rail carrier websites, extracts surcharge data from PDFs, runs complex fuel price calculations, and even sends automated email updates—so our client never has to hunt for surcharge data again.
In this article, we’ll walk through the challenge, the solution, and how Opportune can help your business unlock similar efficiencies—because managing data shouldn’t be this hard.
The Problem: Manual Rail Fuel Surcharge Tracking and Complex Calculations
Before automation, tracking rail fuel surcharges required:
Visiting multiple rail carrier websites to find updates (each with different formats and schedules).
Downloading and extracting data from PDFs published by some carriers.
Copying and pasting data into spreadsheets for tracking.
Manually inputting the data into forecasting models for cost projections.
Repeating the process every month (or weekly) to keep data accurate.
Performing additional calculations for some carriers, such as:
Averaging the On-Highway Diesel Price from prior months to determine the surcharge.
Applying carrier-specific formulas based on fuel price thresholds.
Adjusting surcharge rates dynamically using fuel price banding.
Manually emailing surcharge updates to stakeholders for review and analysis.
These manual efforts led to:
Time-Consuming Processes – Hours spent collecting, calculating, and inputting data.
High Risk of Errors – Manual calculations increased mistakes.
Outdated Decision-Making – Fuel cost projections relied on lagging data.
Inefficient Communication – Surcharge updates were manually sent to distribution lists.
This wasn’t just time-consuming—it was inefficient, prone to mistakes, and left the client making critical freight cost decisions based on outdated information.

The Solution: Python + Alteryx for End-to-End Automation
To streamline this process, we developed a Python-driven web scraping and PDF extraction workflow in Alteryx, integrating real-time data collection, automated calculations, and email distribution.
Scraping Rail Carrier Websites for Fuel Surcharges
Using the Python tool in Alteryx, we built a script that:
✔ Automatically accesses multiple rail carrier websites on a schedule.
✔ Extracts the latest fuel surcharge rates from tables, text, or downloadable files.
✔ Cleans and structures the data for integration into cost models.
Extracting Fuel Surcharges from PDFs
For rail carriers that publish surcharge data in PDFs, we used Python’s PDFplumber to:
✔ Read and extract surcharge values within Alteryx.
✔ Parse unstructured text and convert it into a structured format.
✔ Identify surcharge tables and extract relevant fuel price data.
Automating Fuel Price Calculations
Many rail fuel surcharges are based on external fuel price indices. To handle this, we:
✔ Scraped On-Highway Diesel Price data from the U.S. Energy Information Administration (EIA).
✔ Automated moving average calculations based on prior-month fuel prices.
✔ Applied carrier-specific formulas to determine accurate surcharge rates.
✔ Validated results against historical trends to ensure accuracy.
Automating Data Processing in Alteryx
Once extracted and calculated, the data flows through an Alteryx workflow to:
✔ Standardize and clean the data across all rail carriers.
✔ Validate and flag discrepancies for review.
✔ Load the final data into forecasting models and reporting dashboards.
Automating Distribution of Fuel Surcharge Reports
Previously, after collecting and calculating rail fuel surcharges, someone had to manually send reports via email. With automation, Alteryx now:
✔ Generates updated surcharge reports automatically in Excel and PDF formats.
✔ Emails the reports to a pre-defined distribution list, ensuring all stakeholders receive the latest data instantly.
✔ Triggers alerts if surcharge values exceed predefined thresholds, allowing for proactive decision-making.

The Impact: Measurable Benefits for Freight Cost Management
Managing rail fuel surcharges used to be a frustrating, time-consuming grind—manually checking websites, deciphering PDFs, running calculations, and sending endless emails just to keep up with fluctuating costs. But now? Automation has completely changed the game.
What once took hours of manual effort is now handled seamlessly in the background, allowing teams to focus on strategy instead of spreadsheets. With a 98% reduction in manual work, data no longer needs to be painstakingly collected, copied, or calculated by hand. The system does it all—automatically.
By removing manual data entry and human error, our client can now trust their numbers, ensuring that freight cost forecasts are based on precise, real-time fuel surcharge data. No more outdated figures, no more guesswork—just clean, reliable data at your fingertips.
Scalability? No problem. New rail carriers and pricing structures can be integrated effortlessly, meaning as business needs evolve, the system adapts—without extra workload.
And let’s talk about distribution—because nobody misses the days of manually compiling reports and sending emails. With automated report generation and instant distribution, decision-makers always have the latest surcharge updates when they need them, enabling faster response times and proactive cost adjustments.
This isn’t just an efficiency boost—it’s a complete transformation. By leveraging automation, real-time data, and seamless reporting, companies are turning outdated workflows into high-powered decision-making engines—giving them better insights, better forecasts, and a serious competitive edge.
How Opportune Can Help You
We specialize in thinking outside the box when it comes to data and analytics. We don’t just build reports—we solve problems, finding innovative ways to automate processes, connect data sources, and deliver real-time insights that drive better decision-making. Whether you’re struggling with manual workflows, slow reporting, or disconnected systems, we provide custom solutions tailored to your unique business challenges.
By leveraging cutting-edge automation, analytics, and creative problem-solving, Opportune helps businesses turn data into a powerful strategic asset.
Let’s connect! Contact us today for a demo and discover how we can help you unlock the full potential of your data.
Comments