# CSV Import Format Guide

Your inventory items CSV file **must** have these exact columns in this order:

```
name,category,unit,unit_symbol,unit_purchase_price,threshold_quantity,reorder_quantity
```

## Column Descriptions

| Column | Description | Required | Example |
|--------|-------------|----------|---------|
| **name** | Item name | ✅ Yes | Coca Cola, Flour, Rice |
| **category** | Category name | ❌ No | Canned Goods, Beverages, Dairy |
| **unit** | Unit of measurement | ❌ No | Can, Bottle, Kg, Liter |
| **unit_symbol** | Unit symbol/abbreviation | ❌ No | កំប៉ុង (Can), ដប, Kg |
| **unit_purchase_price** | Purchase price per unit | ❌ No | 40, 50, 7.5 |
| **threshold_quantity** | Low stock threshold | ❌ No | 100, 5, 10 |
| **reorder_quantity** | Quantity to reorder | ❌ No | 50, 0, 25 |

## Valid CSV Example

```csv
name,category,unit,unit_symbol,unit_purchase_price,threshold_quantity,reorder_quantity
Coca Cola,Beverages,Bottle,ដប,1.50,100,50
Flour,Dry Goods,Kg,គីឡូក្រាម,15.00,50,25
Rice,Dry Goods,Kg,គីឡូក្រាម,20.00,100,50
```

## Important Notes

1. **Name is the ONLY required field** - all others are optional
2. **No blank rows** - remove empty rows before uploading
3. **No extra columns** - only use the columns listed above
4. **Encoding must be UTF-8** - save your CSV as UTF-8 encoding
5. **File size limit** - max 10MB per file
6. **Accepted formats**: CSV, XLSX, XLS

## Common Issues & Solutions

### Issue: "Import completed but 0 items imported"
- **Cause**: CSV has no data rows or all items were empty names
- **Solution**: Verify CSV has data rows and name column is not empty

### Issue: File won't upload
- **Cause**: File is too large or wrong format
- **Solution**: Ensure file is CSV/XLSX and under 10MB

### Issue: Some items fail to import
- **Cause**: Referenced categories or units don't exist
- **Solution**: Create categories/units first, or leave those columns blank

### Issue: "Invalid format" error
- **Cause**: Missing name column or wrong header names
- **Solution**: Download example file and compare headers

## How to Fix Your CSV

1. **Download the example file** from the import dialog
2. **Open it in Excel or Google Sheets**
3. **Replace the data with your items** but keep the header row
4. **Save as CSV** (not XLSX)
5. **Upload to the system**

## Need Help?

Check the browser console (F12) for the exact error message and share it for troubleshooting.
