Back to API-Sports in Google Sheets
SheetXAI logo
API-Sports logo
API-Sports · Google Sheets Guide

Bulk-Import Gameweek Player Stats From API-Sports Into Google Sheets

2026-05-13
4 min read
See the Excel version →

The Scenario

You run a small fantasy Premier League platform. It is Saturday at 5 PM, all 10 Gameweek 25 fixtures have just finished, and your recalculation job needs individual player stats — goals, assists, yellow cards, minutes played — from every match loaded into a Google Sheet before your points engine runs at 6 PM.

You have the fixture IDs for all 10 Gameweek 25 matches in column A. You need the player stats for every player who appeared in those 10 fixtures.

The bad version:

  • You write a loop to call the API-Sports fixtures/players endpoint for each of the 10 fixture IDs
  • Each response has a different number of player objects depending on how many substitutes were used
  • Some players who were named in the squad but did not take to the pitch appear in the response with zero minutes
  • You flatten the JSON across 10 calls, normalise the player name formatting, and concatenate the results
  • You discover your minute-parsing logic misreads injury-time minutes for two fixtures
  • It is 5:52 PM, you are still fixing the pipeline, and the 6 PM run is about to fail.

The faster version is one prompt.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your spreadsheet that reads the fixture IDs already in your sheet and calls the API-Sports player stats endpoint for each one.

Open the SheetXAI sidebar and type:

For each fixture ID in column A, fetch player statistics from API-Sports and write player name, team, goals, assists, yellow cards, and minutes played into the sheet. Include only players with more than 0 minutes played. One row per player per fixture.

SheetXAI iterates through the fixture IDs in column A, calls the player statistics endpoint for each, filters out zero-minute players, and writes every row into the sheet. Each row includes the fixture ID as a reference column so your points engine knows which match each stat row belongs to.

What You Get

A flat player stats table ready for your points engine:

  • Fixture ID — reference column linking each stat row back to the match
  • Player name and team — consistent naming format across all 10 fixtures
  • Goals, assists, yellow cards, minutes — one row per player per fixture

Zero-minute players are excluded automatically, so your points engine does not have to filter them out downstream. The table is ready to join to your player roster table on player name.

What If the Data Is Not Quite Ready

Fantasy scoring pipelines have edge cases. SheetXAI can handle them inline.

When player names in the API do not match your roster table

API-Sports uses surname-first formatting for some nationalities. Your roster table uses first-last. The join breaks on three players per gameweek.

After writing the player stats table, check whether each player name in the 'Player' column matches any name in the Roster tab (column A). For any row where there is no exact match, flag it in a 'Name Mismatch' column so the fantasy team can resolve it before the points run.

When a fixture is postponed and returns no player data

One of the 10 fixture IDs has been postponed and the API returns an empty player stats response. Your pipeline errors on the null.

If any fixture ID in column A returns no player stats from API-Sports (postponed or no data available), write 'No Data' into the team and player columns for that fixture ID and skip it rather than erroring. List postponed fixture IDs in a cell at the top of the sheet.

When you need bonus points calculated inline

Your platform awards 1 bonus point for every 2 assists. You want the bonus column calculated before writing to the database.

After writing goals, assists, yellow cards, and minutes, add a 'Bonus Points' column calculated as FLOOR(assists / 2). Also add a 'Points' column using your scoring system: goals = 4 pts, assists = 3 pts, yellow cards = −1 pt, minutes ≥ 60 = 2 pts, minutes 1–59 = 1 pt.

When you want the full gameweek stats and points table in one pass

You have the 10 fixture IDs and want the complete output: player stats, bonus points, total points, and a leaderboard tab showing the top 20 point scorers for the gameweek.

For each fixture ID in column A, fetch player stats from API-Sports. Write player name, team, fixture ID, goals, assists, yellow cards, and minutes into the main tab. Calculate points using: goals = 4 pts, assists = 3 pts, yellow cards = −1 pt, minutes ≥ 60 = 2 pts, minutes 1–59 = 1 pt. Add FLOOR(assists / 2) as bonus points. Sum total points per player. Create a 'Leaderboard' tab with the top 20 point scorers for the gameweek sorted by total points descending.

The pattern: instead of running the data pipeline and the scoring logic as two separate steps, you describe the full output and SheetXAI handles both in one go before your 6 PM cutoff.

Try It

Get the 7-day free trial of SheetXAI and ask it to pull Gameweek player stats for a list of fixture IDs directly into your sheet. The API-Sports integration is included in every SheetXAI plan. For related workflows, see how to pull injury and suspension reports for all squads or the API-Sports in Google Sheets overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more