public-clubsy

Sport Structure Upload via Template (CSV)

Goal

Enable bulk upload of categories, leagues, and teams in the club active season from a CSV template.

This guide documents the actual implemented behavior in the sport structure screen.

Where it is used

Reference files

Required CSV format

Required headers (recommended order):

entity,name,category,league

Columns

Validation rules

Import validates before insert:

  1. File must contain at least header + 1 data row.
  2. Columns entity and name must exist.
  3. If entity=team, category and league are required.
  4. entity outside category|league|team is an error.
  5. For teams, category/league must exist:
    • in active season DB, or
    • in the same file (if created as category/league rows).

If validation errors exist, import is not executed and an error summary is shown.

Insert behavior

Text normalization

Before compare/insert:

Example:

Valid example

entity,name,category,league
category,Senior,,
category,Youth,,
league,Gold,,
league,Silver,,
team,Senior Team A,Senior,Gold
team,Senior Team B,Senior,Silver
team,Youth Team A,Youth,Silver

Expected result:

Invalid example

entity,name,category,league
team,Team without league,Senior,
foo,Unknown entry,,
team,,Senior,Gold
team,Team with missing reference,U13,Gold

Expected errors:

  1. Download base template.
  2. Fill categories and leagues first.
  3. Fill teams referencing exact category/league names.
  4. Import template.
  5. Review creation summary.
  6. Retry if errors with corrected data.

Best practices

Current scope

This import covers:

Not covered yet:

Troubleshooting

“CSV requires columns: entity,name,category,league”

Header does not match. Verify first row.

“Template has no data”

File has only header or is empty.

“team requires category and league”

Incomplete team row.

“category/league does not exist”

Add creation row in same CSV or create it in app first.