Automated MLB Statcast Leaderboard Exporter to Google Sheets
Automatically fetches all 44 public MLB Statcast leaderboard reports for a given season and saves each report to a separate, neatly organized tab within a single Google Sheet.
This automation is a powerful tool for baseball analysts, fantasy players, and fans. It systematically collects a vast amount of advanced statistical data from MLB's Baseball Savant website and organizes it for easy analysis.
Here's how it works:
- You provide the URL of a Google Sheet and specify an MLB season (it defaults to the current year if you don't).
- The automation visits Baseball Savant and downloads 44 different leaderboard reports, covering everything from Exit Velocity and Pitch Movement to Catcher Framing and Outfielder Jump.
- For each report, it downloads the data, cleans it up, and then writes it into your Google Sheet.
- It intelligently manages the spreadsheet, creating a new tab for each report if one doesn't already exist. Existing data is overwritten to ensure you always have the latest information from each run.
The entire process is automated, saving you countless hours of manual data collection and consolidation.
Usage Ideas
- Create a master dashboard for fantasy baseball research to gain an edge in your league.
- Automate data gathering for a sports blog, podcast, or social media channel.
- Perform deep-dive, year-over-year analysis on player performance trends.
- Feed the clean, structured data into a custom model for predicting player or team outcomes.
- Build a comprehensive scouting database by tracking advanced metrics over time.
Customization Ideas
This template is designed to be highly adaptable to your specific data needs. You can work with an assistant to easily customize its behavior:
- Change the Data Source: While it's pre-configured for MLB's Baseball Savant, you can change the target website to pull data from other sources like FanGraphs, or even for different sports like basketball or football.
- Select Your Reports: You don't have to fetch all 44 reports. You can customize the list to include only the stats you care about, whether it's just batting data, pitching-specific metrics, or a custom combination.
- Choose Your Destination: The data is saved to Google Sheets by default, but you can redirect the output to other services you use, such as a database or a different cloud spreadsheet tool.
- Specify the Season: Easily pull data for any historical season to perform year-over-year analysis or research past performance.
- Organize Your Way: You have full control over the names of the tabs created in your spreadsheet, allowing you to match your own naming conventions.
Agent Inputs
Required Parameters
Name | Type | Default |
|---|---|---|
googleSheetUrl | string | None |
Full URL of the Google Spreadsheet where all 44 leaderboard reports will be written, each to its own tab. | ||
Optional Parameters
Name | Type | Default |
|---|---|---|
season | number | 0 |
The MLB season year to fetch data for. Defaults to the current year if not provided or set to 0. | ||