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

# Importing and Exporting Targets

Sales Target supports bulk operations through Excel files. You can export your current targets for reporting or backup, and import new targets in bulk to save time.

<Note>
  Required permission:

  * View Sales Target - Manager
</Note>

## Exporting Targets

To download your current targets as an Excel file:

1. Go to the Sales Target Manager page.
2. Apply any filters if you want to export a specific subset of targets.
3. Click the **Export** button in the filter bar.
4. The file will be downloaded automatically in `.xlsx` format.

The exported file includes all columns visible in the target table: period, city, store, email, active days, total target, total achievement, and category breakdowns.

## Importing Targets

Importing allows you to create multiple targets at once from an Excel file. Follow these steps:

### 1. Download the Template

1. Click the **Import** button in the filter bar.
2. In the upload dialog, click **Download Template** to get the Excel template.
3. Save the template file to your computer.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/Zv4XvRDz7HMdx5Un/images/add-on/sales-target/import-dialog.png?fit=max&auto=format&n=Zv4XvRDz7HMdx5Un&q=85&s=9e28370023c2bb5eb30a5581c47a63e0" alt="Import dialog with template download" width="600" data-path="images/add-on/sales-target/import-dialog.png" />
</div>

<p><em>The Import dialog shows the file upload area and a Download button to get the Excel template.</em></p>

### 2. Fill In the Template

Open the template in Excel or any spreadsheet application and fill in your target data. The template includes the following columns:

| Column               | Required | Description                                     |
| -------------------- | -------- | ----------------------------------------------- |
| **City/Hub**         | Yes      | The location name                               |
| **Store**            | Yes      | The store or outlet name                        |
| **Email**            | Yes      | The representative's email address              |
| **Active Days**      | Yes      | Number of working days (1–31)                   |
| **Total Target**     | Yes      | The monthly sales goal                          |
| **Category columns** | No       | One column per category (e.g., Food, Beverages) |

<Note>
  The category columns in the template match the categories you configured during setup. If you add new categories later, download a fresh template to get the updated columns.
</Note>

### 3. Upload the File

1. Drag and drop your filled Excel file into the upload area, or click to browse and select the file.
2. Wait for the file to be processed. A progress indicator will show the upload status.

### 4. Preview and Review

After the file is processed, a preview table shows all the parsed data:

1. Select the target **month** and **year** using the dropdowns at the top of the preview.
2. Review each row in the preview table.
3. To **edit a cell**, hover over it and click the pencil icon that appears. Modify the value and click outside the cell to save.
4. To **remove a row**, click the trash icon on that row.
5. Rows with validation errors are highlighted in red. The error details appear below the affected row.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/Zv4XvRDz7HMdx5Un/images/add-on/sales-target/import-preview.png?fit=max&auto=format&n=Zv4XvRDz7HMdx5Un&q=85&s=254b4bd44218b25130aa758e71faa765" alt="Import preview table" width="600" data-path="images/add-on/sales-target/import-preview.png" />
</div>

<p><em>The preview table shows parsed data with the target period selector, total store count, and per-row actions.</em></p>

### 5. Submit

Once you are satisfied with the data, click **Submit** to create all the targets. A success message will appear when the import is complete.

## Validation Rules

The following rules are checked during import:

* **City** and **Store** are required fields and cannot be empty.
* **Email** must be a valid email address.
* **Active Days** must be a whole number between 1 and 31.
* **Total Target** must be a number greater than or equal to zero.
* **Category targets** cannot be negative.
* The sum of category targets should match the total target.
* Duplicate entries (same city, store, and email combination) will be flagged.

Rows with validation errors must be corrected or removed before you can submit.

## Import Limits

* **Supported formats**: `.xlsx` and `.xls`
* You cannot import targets for past periods (months that have already ended).
