> ## Documentation Index
> Fetch the complete documentation index at: https://docs.planeconnection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Import Trips

> Import trips in bulk from CSV files, validate data before import, handle errors, and follow best practices for bulk trip creation.

<Info>
  The Operations module must be enabled for your workspace. You also need the appropriate operations
  permissions. Contact your workspace administrator if you cannot access these features.
</Info>

You can import multiple trips at once from a CSV file instead of creating each trip manually. This is useful when migrating from another system, importing a season's schedule, or loading historical trip data.

## File Format Requirements

PlaneConnection accepts CSV files with the following column structure. Column headers must match exactly (case-insensitive).

| Column            | Required | Format       | Description                                                                                  |
| ----------------- | :------: | ------------ | -------------------------------------------------------------------------------------------- |
| `trip_number`     |    No    | String       | Custom trip number. If omitted, the system auto-generates one.                               |
| `origin`          |    Yes   | ICAO code    | Departure airport (e.g., `KTEB`).                                                            |
| `destination`     |    Yes   | ICAO code    | Arrival airport (e.g., `KPBI`).                                                              |
| `departure_date`  |    Yes   | `YYYY-MM-DD` | Departure date in ISO format.                                                                |
| `departure_time`  |    No    | `HH:MM`      | Departure time in 24-hour UTC format.                                                        |
| `arrival_date`    |    No    | `YYYY-MM-DD` | Arrival date in ISO format.                                                                  |
| `arrival_time`    |    No    | `HH:MM`      | Arrival time in 24-hour UTC format.                                                          |
| `trip_type`       |    No    | String       | One of: `charter`, `owner`, `maintenance`, `positioning`, `training`. Defaults to `charter`. |
| `aircraft`        |    No    | String       | Aircraft tail number (N-number). Must match an aircraft in your fleet.                       |
| `pic`             |    No    | String       | Email of the Pilot in Command. Must match a crew member in your roster.                      |
| `sic`             |    No    | String       | Email of the Second in Command. Must match a crew member in your roster.                     |
| `passenger_count` |    No    | Number       | Number of passengers for the trip.                                                           |
| `notes`           |    No    | String       | Internal notes for the trip.                                                                 |
| `status`          |    No    | String       | Initial status. Defaults to `draft`. Allowed values: `draft`, `scheduled`.                   |

<Tip>
  Download a sample CSV template from the import page to see the exact format and column names
  expected.
</Tip>

## Import Workflow

<Steps>
  ### Step 1: Prepare your CSV file

  Create a CSV file with the required columns. Ensure all ICAO codes are valid and dates are in ISO format. If referencing aircraft or crew, verify that the tail numbers and emails exist in your workspace.

  <Warning>
    The CSV file must use UTF-8 encoding. Files with non-UTF-8 characters (common in exports from
    older systems) may cause validation errors.
  </Warning>

  ### Step 2: Upload the file

  Navigate to **Ops > All Trips** and click **Import Trips** (or use the actions menu). Select your CSV file and click **Upload**.

  ### Step 3: Map columns

  If your CSV column headers do not exactly match the expected names, the system displays a column mapping screen. Map each source column to the corresponding PlaneConnection field. Unmapped columns are ignored.

  ### Step 4: Review validation results

  The system validates every row before importing. The validation summary shows:

  * **Valid rows** -- ready to import.
  * **Warnings** -- rows that will import but have potential issues (e.g., aircraft not found, crew not matched).
  * **Errors** -- rows that cannot be imported (e.g., missing required fields, invalid ICAO codes, invalid dates).

  Review and correct any errors in your source file, then re-upload if needed.

  ### Step 5: Confirm and import

  Click **Import** to create the trips. All imported trips are created in the specified status (default: `draft`). A summary shows the number of trips created, warnings encountered, and any rows that were skipped.
</Steps>

## Validation and Error Handling

The import process validates the following before creating trips:

| Validation             | Rule                                                                         | Error Behavior                                     |
| ---------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------- |
| Required fields        | `origin` and `destination` must be present                                   | Row rejected                                       |
| ICAO codes             | Airport codes must exist in the airport database                             | Warning (trip created without validated airport)   |
| Date format            | Dates must be valid ISO 8601 (`YYYY-MM-DD`)                                  | Row rejected                                       |
| Aircraft match         | Tail number must match an Active aircraft in your fleet                      | Warning (trip created without aircraft assignment) |
| Crew match             | Email must match a crew member in your workspace                             | Warning (trip created without crew assignment)     |
| Duplicate detection    | Trips with the same origin, destination, and departure date/time are flagged | Warning (trip still created)                       |
| Trip number uniqueness | If provided, `trip_number` must not already exist in the workspace           | Row rejected                                       |

<Info>
  Rows with warnings are still imported -- the system creates the trip without the unmatched
  reference (aircraft, crew). You can assign these manually after import from the trip detail page.
</Info>

## Bulk Import Best Practices

<Accordion title="Start with a small test batch">
  Import 5-10 trips first to verify your CSV format and column mapping. Review the results before
  importing a full season or historical dataset.
</Accordion>

<Accordion title="Use draft status for review">
  Import trips with `status` set to `draft` (the default). This gives dispatchers a chance to
  review, assign aircraft and crew, and confirm each trip individually.
</Accordion>

<Accordion title="Validate ICAO codes beforehand">
  Cross-reference your airport codes against the PlaneConnection airport database. Common issues
  include using IATA codes (e.g., `TEB` instead of `KTEB`) or codes for airports not in the system.
</Accordion>

<Accordion title="Handle multi-leg trips">
  Each row in the CSV creates a single-leg trip. For multi-leg trips, import each leg as a separate
  row with the same `trip_number`. The system groups legs under the same trip when they share a trip
  number.
</Accordion>

<Accordion title="Clean historical data">
  When importing historical trips, set the `status` to `completed` only if the trip has already been
  flown. Include actual departure and arrival times for accurate historical reporting.
</Accordion>

## Related

<CardGroup cols={2}>
  <Card title="Create a Trip" href="/how-to/ops/create-trip">
    Create trips manually with the trip wizard.
  </Card>

  <Card title="Trip Statuses" href="/reference/trip-statuses">
    Understanding trip lifecycle statuses after import.
  </Card>

  <Card title="Manage Aircraft" href="/how-to/ops/manage-aircraft">
    Ensure aircraft records exist before importing trips with aircraft assignments.
  </Card>

  <Card title="Manage Crew" href="/how-to/ops/manage-crew">
    Set up crew members before importing trips with crew assignments.
  </Card>
</CardGroup>
