Magento Import and Export — CSV Profiles and Scheduled Import
In this tutorial, you'll learn how to import and export Magento data using CSV files, configure scheduled import/export profiles, handle validation errors, and manage large catalogs efficiently.
What You'll Learn
- CSV structure for products, customers, and inventory sources
- How to create and run import profiles in the admin panel
- Import behaviors: Add/Update, Replace, Delete, Append
- How to schedule imports and exports via cron
- How to handle validation errors and failed imports
- Best practices for importing large catalogs
Why It Matters
Every store needs to import data — from initial product catalog setup to ongoing supplier feeds. Doing it manually through the admin panel is impractical for more than a few dozen products. CSV import/export is the standard method for bulk data operations.
Real-World Use
A wholesale distributor receives daily product feeds from 10 suppliers in CSV format. Each feed contains 2,000 to 5,000 products with prices, stock levels, and descriptions. A scheduled import runs every night at midnight, processes all CSV files, validates the data, updates existing products, and emails a report to the operations team. This saves 20 hours of manual work per week.
Learning Path
flowchart LR
A[Indexing] --> B[Performance Optimization]
B --> C[Import & Export]
C --> D[B2B Features]
C --> E[Extensions Marketplace]
E --> F[Multi-Store]
style C fill:#3b82f6,color:#fff
Import Types
Magento supports importing several entity types:
| Entity | Description |
|---|---|
| Products | Simple, configurable, bundled, grouped, downloadable, virtual |
| Customers | Customer accounts with addresses |
| Customer Addresses | Address data only |
| Stock Sources | Multi-source inventory quantities |
| Inventory Sources | Warehouse and location definitions |
| Product Images | Images via CSV referencing file paths |
CSV Structure
Every import file must follow a specific CSV structure with required columns.
Product CSV
Required columns for simple products:
sku,name,product_type,attribute_set_code,price,qty,category_ids,visibility,status
TS-RED-01,"Red T-Shirt",simple,Default,19.99,100,"3,4",Catalog, Search,1
TS-BLUE-01,"Blue T-Shirt",simple,Default,19.99,150,"3,4",Catalog, Search,1
Additional columns for more attributes:
sku,name,product_type,attribute_set_code,price,qty,category_ids,visibility,status,description,short_description,weight
TS-RED-01,"Red T-Shirt",simple,Default,19.99,100,"3,4",Catalog, Search,1,"A comfortable red cotton t-shirt.","Red cotton t-shirt",0.3
Customer CSV
email,_website,_store,firstname,lastname,addresses_city,addresses_country
john@example.com,base,default,John,Doe,New York,US
jane@example.com,base,default,Jane,Smith,Los Angeles,US
Creating an Import
Step-by-Step Import
- Navigate to System > Import
- Select Entity Type (Products, Customers, etc.)
- Choose Import Behavior
- Select the CSV file to upload
- Click Check Data for validation
- If valid, click Import
Import Behaviors
| Behavior | Description |
|---|---|
| Add/Update | Adds new entities, updates existing ones by SKU (products) or email (customers) |
| Replace | Deletes existing entity and inserts new one with same ID |
| Delete | Removes entities matching the SKU or email in the CSV |
| Append | Adds complex data like tier prices or configurable options |
Export
Exporting data is simpler than importing since validation is not needed.
- Navigate to System > Export
- Select Entity Type
- Apply Export Filters (e.g., only products with price > $50)
- Click Export
Export Filters
Filter exports to limit file size:
| Filter | Example |
|---|---|
| SKU | TS-% to export all T-shirt products |
| Type | simple for simple products only |
| Status | 1 for enabled products |
| Price | 25 - 100 for products between $25 and $100 |
| Attribute Set | Default for default attribute set |
| Stock | 0 for out-of-stock products |
Scheduled Import and Export
Automate imports and exports using cron-based profiles.
Create Scheduled Import
- Go to System > Scheduled Imports/Exports
- Click Add Scheduled Import
- Configure:
| Setting | Description |
|---|---|
| Name | Supplier Feed - Electronics |
| Entity Type | Products |
| Import Behavior | Add/Update |
| File Source | FTP/SFTP, Local, or Custom |
| File Path | /imports/electronics_feed.csv |
| Cron Frequency | Daily at 2 AM |
| Fail Email Recipient | admin@example.com |
Create Scheduled Export
- Same page, click Add Scheduled Export
- Configure entity type, filters, output location, and cron frequency
- The export file is generated on schedule and placed in the specified location
Error Handling
When imports fail, Magento provides diagnostic information.
Import History
- Go to System > Import History
- View all past imports with status (Success, Failed, Validation Errors)
- Download Error Report CSV for failed imports
Error Report CSV
The error report contains each row that failed and the reason:
sku,name,error_message
TS-123,Red T-Shirt,SKU already exists
TS-456,Blue T-Shirt,Invalid attribute set ID
TS-789,,SKU is required
Validation Failures
Common validation errors:
- Missing required columns (sku, name, product_type)
- Invalid attribute values (wrong attribute set)
- Duplicate SKUs in the same file
- Invalid price format (non-numeric)
- Category IDs that do not exist
Large Catalog Import
Importing tens of thousands of products requires special handling.
Split CSV Files
Divide large imports into chunks of 5,000 rows:
# Split CSV into 5000-row chunks (preserving header)
head -1 large_import.csv > header.csv
tail -n +2 large_import.csv | split -l 5000 - chunk_
for f in chunk_*; do cat header.csv "$f" > "import_$f.csv"; done
PHP and Server Configuration
memory_limit = 4096M
max_execution_time = 18000
max_input_time = -1
Cron-Based Import
For very large catalogs, use scheduled imports during off-peak hours:
# Set up a cron job for import processing
0 3 * * * /usr/bin/php /var/www/magento/bin/magento cron:run --group=import_export
Best Practices
Always back up your database before running a large import. Test imports on a staging environment first. Validate SKU uniqueness to avoid duplicates. Ensure CSV files use UTF-8 encoding. Keep column headers consistent between imports. Monitor the import history after each scheduled import. Use the Replace behavior only when you need to completely refresh data. For price updates only, use the Add/Update behavior with only the SKU and price columns.
Common Mistakes
- Importing a CSV with missing required columns, causing immediate validation failure and zero products imported
- Using the Replace behavior when Add/Update was intended, which deletes and recreates products losing all associated data
- Importing a CSV with BOM (Byte Order Mark) encoding, causing Magento to fail reading the file
- Running a large import during business hours, slowing the storefront for customers
- Not checking the Import History report after a scheduled import, missing failed rows that need attention
Practice Questions
- What is the difference between Add/Update and Replace import behaviors?
- Why should you split a 100,000-product CSV into smaller files?
- Where do you find detailed error information after a failed import?
Challenge: Create a scheduled import profile that downloads a CSV from an FTP server every night at 1 AM, imports products with Add/Update behavior, and sends an email report with the import status.
FAQ
Mini Project
Create a product import workflow: receive a CSV file from a supplier, validate it against Magento's required columns, split it into 5,000-row chunks, run the import through a scheduled profile, check the import history for errors, and send a summary email with the count of imported, updated, and failed rows.
What's Next
Now that you can manage data, explore Magento B2B Features for shared catalogs and company accounts. Then continue with Magento Extensions Marketplace to extend store functionality.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro