Back to API-Sports in Excel
SheetXAI logo
API-Sports logo
API-Sports · Excel Guide

Dump a Full Head-to-Head Record Into Excel for Win/Loss Analysis

The Scenario

You are a sports betting researcher. You have been asked to prepare a 10-year head-to-head analysis of Liverpool vs Manchester City for a client who bets on the rivalry fixture. The client wants every match between the two clubs across all competitions — Premier League, FA Cup, League Cup, Champions League — with date, competition, home score, and away score.

You have the API-Sports subscription. The deliverable is an Excel workbook with the full history and a summary breakdown by competition.

The bad version:

  • You construct the API-Sports H2H endpoint URL with Liverpool's team ID (40) and Manchester City's team ID (50)
  • The response is 47 match objects with three levels of nesting; Power Query auto-detects none of the useful fields
  • You write an M formula, it expands one level, errors on the second
  • You script it in Python, get the data, export to CSV, open in Excel
  • You discover the competition names are inconsistent — "Premier League" and "England Premier League" appear for the same tournament — and your pivot table grouping breaks
  • The client is chasing you and the pivot is still broken.

The faster version is one prompt.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your Excel workbook that calls the H2H endpoint and normalises the competition names on the way in.

Open the SheetXAI sidebar and type:

Fetch all head-to-head fixtures between Liverpool and Manchester City for the last 10 years and list them in this workbook with date, competition, home team, away team, home score, and away score. Standardise competition names so 'Premier League' and 'England Premier League' both read 'Premier League'. Sort by date descending.

SheetXAI calls the API-Sports head-to-head endpoint, applies date filtering, normalises the competition name variants, and writes the result as a clean table. The pivot table you build on top of it will group correctly.

What You Get

A structured match history table:

  • Date — formatted as Excel dates, not Unix timestamps
  • Competition — normalised: Premier League, FA Cup, League Cup, Champions League, Other
  • Home and away teams — with match direction clear for each fixture
  • Scoreline — home score and away score per match

The competition normalisation means your pivot table groups correctly from the first build. You do not have to clean the data after the pull.

What If the Data Is Not Quite Ready

H2H research for a client brief usually needs more than a raw list. SheetXAI can add the analytical layers inline.

When you want win/draw/loss aggregates by competition

The match list is in the workbook but your client wants a summary: how many times did each team win in each competition?

Count Liverpool wins, draws, and Manchester City wins from the match history in this workbook, grouped by the competition column. Write the summary into a new tab called 'H2H Summary' with one row per competition.

When the client wants a specific manager era filtered out

Your client is interested only in the Klopp vs Guardiola head-to-head. Klopp took over Liverpool in October 2015 and left in May 2024.

Filter the match history to fixtures played between October 2015 and May 2024. Move those rows to a new tab called 'Klopp Era' and add a column showing the goal difference per match in Liverpool's favour.

When you want matches flagged by goal volume for over/under analysis

Your client also bets over/under total goals. They want every match flagged as Over 2.5 or Under 2.5.

Add a column called 'Goals Total' with the sum of home score and away score for each match. Add a column called 'Over/Under 2.5' labelled 'Over' if total goals are 3 or more and 'Under' otherwise.

When you want the full client brief built in one pass

The client wants the raw match list, the H2H summary by competition, the Klopp era filtered separately, the Over/Under flag, and a cover tab with headline statistics.

Fetch all Liverpool vs Manchester City fixtures from the last 10 years with date, competition, home team, away team, home score, and away score. Standardise competition names. Add a Goals Total and Over/Under 2.5 column. Write the raw list to the main tab. Create an 'H2H Summary' tab with win/draw/loss counts by competition. Create a 'Klopp Era' tab filtered to October 2015–May 2024. Create a 'Cover' tab showing: total matches, Liverpool win rate, City win rate, draw rate, and percentage of matches Over 2.5 goals.

The pattern: instead of pulling the data and building the client deliverable as three separate workbook-building sessions, you describe the full brief and SheetXAI builds all of it in one go.

Try It

Get the 7-day free trial of SheetXAI and ask it to pull a head-to-head record for any fixture pair directly into your Excel workbook. The API-Sports integration is included in every SheetXAI plan. For related workflows, see how to pull fixture lists and standings in Excel or the API-Sports in Excel overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more