# Excel Import Setup for Fitness Exercises

## File Locations

The seeder looks for Excel files in the `docs/` directory:

- `docs/fitness_exercises_kg.xlsx` - Exercises with kg measurements
- `docs/fitness_exercises_lb.xlsx` - Exercises with lb measurements

## Excel File Structure

Each Excel file should have the following columns (A-D):

| Column | Header | Description | Valid Values |
|--------|--------|-------------|--------------|
| A | Category | Exercise category | Text (e.g., "Chest", "Back", "Legs") |
| B | Exercise | Exercise name | Text (e.g., "Push-ups", "Bench Press") |
| C | Level | Difficulty level | beginner, intermediate, expert |
| D | UnitPref | Unit preference | kg, lb, both |

## Example Excel Content

```
Category    | Exercise      | Level        | UnitPref
Chest       | Push-ups      | beginner     | both
Chest       | Bench Press   | intermediate | kg
Back        | Pull-ups      | intermediate | both
Legs        | Squats        | beginner     | both
Legs        | Deadlifts     | expert       | both
Core        | Plank         | beginner     | both
```

## Usage

1. Create Excel files with the structure above
2. Place them in `docs/` directory
3. Run the seeder: `php spark db:seed FitnessExerciseSeeder`

## Features

- **Automatic Category Creation**: Categories are created if they don't exist
- **Batch Processing**: Processes 500 records at a time for efficiency
- **Duplicate Prevention**: Uses `ignore(true)` to prevent duplicate entries
- **Validation**: Level and unit preferences are validated with fallbacks
- **Progress Feedback**: Shows which files were imported

## Requirements

- PhpSpreadsheet: `composer require phpoffice/phpspreadsheet --ignore-platform-reqs`
- Excel files in correct format
- Database tables: `fitness_ex_categories`, `fitness_exercises`

## Troubleshooting

If you see "Seeds skipped" messages:

1. **Excel files not present**: Create the Excel files in `docs/` directory
2. **Vendor autoload not found**: Run `composer install`
3. **PhpSpreadsheet not available**: Run `composer require phpoffice/phpspreadsheet --ignore-platform-reqs`

## Next Steps

After successful import, exercises will be available in the fitness module for:
- Program creation
- Exercise selection
- Trainer program building
- Player workout tracking
