Noucair ZemraniPlatform engineering & practical automation

ENGINEERING NOTES

How Football Players Can Use n8n to Understand Match Data

By Noucair Zemrani ·

After a match, a player wants answers to simple questions. How many passes reached a teammate? Where did possession get lost? Which moments should they watch again?

The information may be spread across match statistics, video clips, and a coach’s spreadsheet. n8n can collect those records and prepare a short report for the player and analyst. This football analytics project is an illustrative design with fictional player data.

Football data workflow from player match records to validated passing statistics and an analyst-reviewed report.

Start with one useful question

Imagine a midfielder called Sam reviewing their passing. Their analyst records 40 attempted passes, 32 completed passes, and three video timestamps. The report says “Sam completed 32 of 40 passes — 80%. Review 18:24, 42:10, and 67:35 with the coach.” These figures and timestamps are fictional.

The percentage gives an overview. The clips help explain what happened. An unsuccessful forward pass under pressure deserves a different conversation from an unpressured pass behind a teammate.

Choose data that can answer the question

Individual passing analysis needs player event data or an analyst’s records. A fixture and results feed may lack those details. For a portfolio demonstration, StatsBomb’s open-data repository provides football data for selected competitions. Check its coverage and usage terms before choosing a match or publishing derived work.

For the first version, create a sheet with matchId, playerId, playerName, passesAttempted, passesCompleted, and reviewClips. Give each player and match a stable identifier. Map numeric columns to the field names shown below before calculating the percentage.

Build the n8n football analytics workflow

  • Start the review. Use a Manual Trigger after the analyst finishes entering the data.
  • Read the records. Load the sheet with Google Sheets, or use HTTP Request with your provider’s API and credentials.
  • Select one player and match. Filter on playerId and matchId.
  • Check and calculate. Validate identifiers and passing counts, then calculate the percentage.
  • Prepare a draft report. Combine the figures, source reference, update time, and review timestamps. Have the analyst review the draft before sharing it.

The n8n HTTP Request documentation explains API requests and authentication. For spreadsheet input, place this JavaScript in a Code node configured to run once for all items.

return $input.all().map((item) => {
  const row = item.json;
  const parseCount = value => {
    if (typeof value === 'string' && !/^\d+$/.test(value.trim())) return null;
    if (typeof value !== 'string' && typeof value !== 'number') return null;
    const count = Number(value);
    return Number.isSafeInteger(count) && count >= 0 ? count : null;
  };
  const attempted = parseCount(row.passesAttempted);
  const completed = parseCount(row.passesCompleted);
  const validId = v => typeof v === 'string' && v.trim().length > 0;
  const valid = validId(row.matchId) && validId(row.playerId) && attempted !== null && completed !== null && completed <= attempted;
  return {json:{...row,
    passCompletionPercent: valid && attempted > 0 ? Math.round(completed / attempted * 1000) / 10 : null,
    reviewStatus: valid ? 'Ready for review' : 'Check the source data'
  }};
});

With zero attempted passes, the percentage stays empty because there is no rate to calculate. Missing counts, impossible totals, or missing player and match IDs flag the record for review. Route only records marked Ready for review to the report step.

Make the report easy to read

A player should quickly find what happened, what to review, and where the information came from. Include the match and player, the counts and percentage, analyst-supplied video links or timestamps, and the source update time.

An optional AI step can turn the calculated fields into a short paragraph. Instruct it to preserve the numbers, flag missing information, and avoid inventing reasons for a performance change. A lower passing percentage alone cannot explain fatigue, stronger pressure, or harder passes. The coach and player provide that context.

Test before sharing the report

  • 32 completed passes from 40 attempts. Expect 80%.
  • Zero attempted and completed passes. Expect an empty percentage.
  • More completed passes than attempts. Expect Check the source data.
  • Missing player ID, match ID, or a count. Expect Check the source data.

Use matchId and playerId together to identify the saved report. Configure the destination to update that record on reruns. Track delivery separately so a rerun does not automatically send the same message again.

Turn the project into portfolio evidence

Show one complete example from source record to reviewed report. Include the workflow diagram, calculation, and recorded test outcomes. A short screen recording can demonstrate how a source change updates the report. The importable demonstration below includes recorded local JavaScript output. Its four-node execution was also verified in n8n 2.48.4; the exact scope is explained beside the results.

Continue with the n8n workflow examples for other practical projects, or read Practical Automation for validation, recovery, and workflow ownership.

Import a complete n8n football data demo

Download the football workflow, expected output, and test script (ZIP)

You can try the calculation without an API key, Google account, or real player records. The complete workflow has four nodes: Manual Trigger → Fictional match records → Validate and calculate → Prepare review report. The last node produces a readable draft for every record and withholds a performance summary when validation fails. It sends no messages and writes no external records.

  1. Copy the JSON below into football-data-review.json. In n8n, choose Import from File and select it.
  2. Open the three Code nodes and confirm they use Run Once for All Items. The fixture node contains four clearly fictional records.
  3. Choose Execute workflow. Open Prepare review report → Output → JSON and inspect the four results.
  4. Sam should show 80%; the zero-attempt record should have a null percentage; the impossible total and missing ID should say Check the source data.

Complete football workflow JSON

{
  "id": "footballDemo2026",
  "name": "Football passing review \u2014 fictional data demo",
  "nodes": [
    {
      "id": "9dd28955-d547-4694-9ed1-f26c108f714e",
      "name": "Start demo",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "651c2da8-164e-4150-a227-7a16dd871f3b",
      "name": "Fictional match records",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        260,
        0
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "return [\n  {matchId:'demo-001',playerId:'sam',playerName:'Sam',passesAttempted:40,passesCompleted:32,reviewClips:['18:24','42:10','67:35']},\n  {matchId:'demo-001',playerId:'zero',playerName:'Zero attempts',passesAttempted:0,passesCompleted:0,reviewClips:[]},\n  {matchId:'demo-001',playerId:'invalid',playerName:'Impossible total',passesAttempted:10,passesCompleted:12,reviewClips:[]},\n  {matchId:'demo-001',playerName:'Missing player ID',passesAttempted:40,passesCompleted:32,reviewClips:[]}\n].map(json => ({json}));"
      }
    },
    {
      "id": "0bcd0de7-841c-4ae9-88d5-54cba3e818f6",
      "name": "Validate and calculate",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        0
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "return $input.all().map((item) => {\n  const row = item.json;\n  const parseCount = value => {\n    if (typeof value === 'string' && !/^\\d+$/.test(value.trim())) return null;\n    if (typeof value !== 'string' && typeof value !== 'number') return null;\n    const count = Number(value);\n    return Number.isSafeInteger(count) && count >= 0 ? count : null;\n  };\n  const attempted = parseCount(row.passesAttempted);\n  const completed = parseCount(row.passesCompleted);\n  const validId = v => typeof v === 'string' && v.trim().length > 0;\n  const valid = validId(row.matchId) && validId(row.playerId) && attempted !== null && completed !== null && completed <= attempted;\n  return {json:{...row,\n    passCompletionPercent: valid && attempted > 0 ? Math.round(completed / attempted * 1000) / 10 : null,\n    reviewStatus: valid ? 'Ready for review' : 'Check the source data'\n  }};\n});"
      }
    },
    {
      "id": "cef4184d-f3b8-4206-ba36-8852a72783d2",
      "name": "Prepare review report",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        780,
        0
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "return $input.all().map(({json:r}) => {\n  const valid = r.reviewStatus === 'Ready for review';\n  const summary = !valid ? 'Report withheld: check player ID, match ID, and passing counts.'\n    : r.passCompletionPercent === null ? `${r.playerName}: no attempted passes; no completion percentage.`\n    : `${r.playerName} completed ${r.passesCompleted} of ${r.passesAttempted} passes (${r.passCompletionPercent}%).`;\n  return {json:{matchId:r.matchId,playerId:r.playerId ?? null,reviewStatus:r.reviewStatus,\n    passCompletionPercent:r.passCompletionPercent,summary,\n    reviewClips:valid && Array.isArray(r.reviewClips) ? r.reviewClips : [],\n    source:'Fictional demonstration records',deliveryStatus:'Draft only \u2014 analyst review required'}};\n});"
      }
    }
  ],
  "connections": {
    "Start demo": {
      "main": [
        [
          {
            "node": "Fictional match records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fictional match records": {
      "main": [
        [
          {
            "node": "Validate and calculate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate and calculate": {
      "main": [
        [
          {
            "node": "Prepare review report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}

Verified workflow output

The exact JavaScript from the three exported Code nodes was executed sequentially in Node.js 24.22.1 on 18 November 2026. The output below is from that local run with fictional inputs. Four fixture assertions and six invalid-count checks passed. The same export was then imported and executed using the n8n 2.48.4 CLI. All four nodes completed with execution status success, and the four report records exactly matched the output below. This verifies the self-contained fictional-data workflow, not a Google Sheets connection, a match-data API, or report delivery.

[
  {
    "matchId": "demo-001",
    "playerId": "sam",
    "reviewStatus": "Ready for review",
    "passCompletionPercent": 80,
    "summary": "Sam completed 32 of 40 passes (80%).",
    "reviewClips": [
      "18:24",
      "42:10",
      "67:35"
    ],
    "source": "Fictional demonstration records",
    "deliveryStatus": "Draft only — analyst review required"
  },
  {
    "matchId": "demo-001",
    "playerId": "zero",
    "reviewStatus": "Ready for review",
    "passCompletionPercent": null,
    "summary": "Zero attempts: no attempted passes; no completion percentage.",
    "reviewClips": [],
    "source": "Fictional demonstration records",
    "deliveryStatus": "Draft only — analyst review required"
  },
  {
    "matchId": "demo-001",
    "playerId": "invalid",
    "reviewStatus": "Check the source data",
    "passCompletionPercent": null,
    "summary": "Report withheld: check player ID, match ID, and passing counts.",
    "reviewClips": [],
    "source": "Fictional demonstration records",
    "deliveryStatus": "Draft only — analyst review required"
  },
  {
    "matchId": "demo-001",
    "playerId": null,
    "reviewStatus": "Check the source data",
    "passCompletionPercent": null,
    "summary": "Report withheld: check player ID, match ID, and passing counts.",
    "reviewClips": [],
    "source": "Fictional demonstration records",
    "deliveryStatus": "Draft only — analyst review required"
  }
]

Replace the fixture with match data

After checking the demo in your n8n version, replace only Fictional match records with Google Sheets or an HTTP Request source. Emit one item per player and match using the same fields. First filter the selected player and match, then connect the data to Validate and calculate. Test with permitted data in an isolated workflow before adding storage or delivery.

The report remains a draft for an analyst. Passing accuracy alone does not measure overall performance or explain its cause. Add licensed event detail and coach context if you need to analyse pressure, pass difficulty, or possession losses; this demo does not calculate those metrics.

For troubleshooting, continue with n8n API authentication checks and safe API retries.

← All engineering articles