How to Import Products in Magento 2: Step-by-Step Guide (2026)
Quick Summary
This guide provides complete instructions for importing products in Magento 2 using three methods: Admin Panel CSV upload, Command Line Interface (CLI), and REST/SOAP API.
We explain CSV preparation, including the required columns: SKU, name, price, type, attribute_set_code, product_websites, categories, quantity, and more.
Learn the Admin Panel method with step-by-step instructions and discover CLI import for developers managing large catalogs with shell access.
Understand custom attributes and attribute sets, creating attributes in Stores > Attributes > Product, assigning to relevant sets, and much more.
Importing products manually in Magento 2 can quickly become a headache, especially when you’re managing hundreds or thousands of SKUs. That’s where Magento’s built-in import tools come in handy.
Whether you’re a store owner or working with Magento experts, knowing how to import products in Magento 2 can save hours of effort and reduce manual errors. From CSV files to the command line and API methods, there are several ways to handle bulk imports.
In this guide, we’ll break down everything, from preparing your CSV to using the CLI and REST API, plus common mistakes to avoid. So, let’s get started!
How to Import Products in Your Magento 2 Store?
Magento 2 offers multiple ways to import products, each suited for different use cases, technical skills, and store sizes. Whether you prefer a no-code option through the admin panel or need advanced automation via CLI or API, Magento has you covered.
Let’s break down the three main methods to help you choose the right one and walk through each step to ensure a smooth import process.
Method 1: Import Products Using Admin Panel
If you prefer working through Magento’s dashboard and have a smaller product batch to import, the Admin Panel method is the easiest and most beginner-friendly way to go.
It doesn’t require any coding and gives visual feedback for each step, making it a safe choice for store managers and non-developers.
Preparing the CSV File
Before uploading, you’ll need a properly formatted CSV file. Magento provides a sample you can download and modify:
Go to System > Data Transfer > Import
Select Entity Type: Products
Click Download Sample File
Key columns you’ll typically need:
Column
Purpose
sku
Unique identifier for the product
name
Product name
price
Selling price
type
Product type (e.g., simple, configurable)
attribute_set_code
Which attribute set to use
product_websites
Website codes (e.g., base)
categories
Comma-separated category names or paths
qty & is_in_stock
Inventory fields
base_image, small_image, thumbnail
Image references
Tip: Place your images in /pub/media/import/ and reference them by filename (e.g., tshirt.jpg).
Step-by-Step: Import via Admin
Once your CSV file is ready, start importing products from your admin panel:
Go to System > Data Transfer > Import.
Under Entity Type, choose Products.
In Import Behavior, select one:
Add/Update: Updates existing products and adds new ones
Replace: Overwrites existing product data
Delete: Removes existing products
Upload your CSV file using Choose File
Click Check Data to validate file structure and content
If validation passes, click ‘Import’.
Magento will process the file and display success or error messages based on the data.
Common CSV Errors and Fixes
Here are some common CSV errors and fixes to ensure a smooth product import:
Error
Reason
Fix
Missing required fields
Core columns like sku or attribute_set_code are empty
Fill in all required fields
Invalid value for column
A value doesn’t match the expected format or option
Check attribute values in Magento admin
Image not found
Image file is missing from import folder
Upload to /pub/media/import/ before importing
Using the Admin Panel for product import is perfect for quick tasks and small-to-medium catalogs. For larger imports or recurring updates, however, CLI or API options may offer better performance and automation potential.
Method 2: Import Products Using Command Line (CLI)
For developers and system administrators, using the command line is one of the fastest and most efficient ways to import products in Magento 2. It allows for faster execution, especially with large files, and can be easily automated or integrated with custom scripts.
CLI is ideal when:
You’re working on staging or production environments with shell access
The product list is large (thousands of SKUs)
You want to automate the process or integrate it with cron jobs
It avoids the file upload limits and timeouts you may face in the Admin Panel.
Step-by-Step Command Usage
Magento 2 does not come with a default CLI command for importing products, so you’ll typically use:
This example runs the import every day at 2:00 AM. Using CLI for product imports is a powerful option when speed, automation, and control matter. It’s especially suited for larger operations or technically advanced teams who want full access to the backend workflow.
Method 3: Importing via Magento 2 API (REST/SOAP)
If you’re building a real-time integration between Magento and another system like an ERP, PIM, or mobile app, the Magento 2 API is the most flexible way to create or update products. You can use REST or SOAP, but REST is more widely used and easier to test with tools like Postman or curl.
API is ideal when:
You want to programmatically create or update products
You’re integrating with external systems
You need real-time or event-based imports
You’re automating a custom backend workflow
REST API Endpoint
To create a new product via REST, use the following endpoint:
POST /V1/products
You’ll need an admin access token for authorization. You can generate it by sending a POST request to /V1/integration/admin/token.
Sample API Payload for a Simple Product
Here’s a sample JSON payload to create a simple product:
type_id: Product type (simple, configurable, etc.)
attribute_set_id: Numeric ID for the attribute set
visibility: 4 = Catalog, Search
saveOptions: Saves associated options like custom attributes (if provided)
Use tools like Postman, curl, or your backend code (PHP, Python, Node.js) to send the request.
Helpful Tips
To update an existing product, use the same endpoint (PUT /V1/products/:sku)
You can also upload product images via a separate endpoint (/V1/products/media)
For bulk operations, loop through the payloads or use batch APIs with proper error handling
Magento 2’s API gives you complete flexibility for remote product management. And it’ll be ideal to hire Magento developers if you’re working on system integrations or large-scale automation tasks.
Move your products to Magento 2 in just a few clicks
How to Handle Custom Attributes and Attribute Sets
Magento 2’s flexibility shines through its use of custom attributes and attribute sets. These features let you shape your product data to fit exactly what your store sells, whether it’s clothing, electronics, books, furniture, or any niche-specific inventory.
Getting these settings right during product imports ensures your catalog stays consistent, organized, and easy to manage. It also helps your store’s filters, search, and display settings work properly.
Understanding Attribute Sets
An attribute set defines the structure or “template” for a product type. Think of it as a container that groups relevant attributes (like size, color, or warranty) based on the category or product type.
For example:
A “Clothing” set might include size, color, and fabric
An “Electronics” set might include warranty, voltage, and brand
This lets you avoid clutter and only show relevant fields for each product type. When importing products, Magento uses the attribute_set_code in your CSV to decide which structure to apply to each item.
In this case, Magento looks for the “Electronics” attribute set and applies it to the product.
Important: If the attribute set doesn’t exist in your system, the import will fail. So always make sure it’s already created — either manually through the Admin Panel or via CLI/API — before you run your import.
Creating and Using Custom Attributes
Custom attributes are fields that you create in addition to Magento’s built-in ones, like name, price, SKU, etc. These could be things like brand, material, style, fit, or any other product-specific detail you want to track.
To use custom attributes in your import file:
First, create them in Stores > Attributes > Product
Here, Magento will only import the brand and material values if those attributes already exist and are linked to the “Clothing” attribute set. If not, Magento will skip them or throw an error, so don’t skip those setup steps.
Common Issues and Fixes
Here are some common issues and fixes you should consider:
Issue
Cause
Fix
“Invalid attribute” error
The attribute doesn’t exist
Create it manually before importing
Data not saving
Attribute not in attribute set
Edit the attribute set to include the attribute
Dropdown value missing
Attribute uses options
Predefined dropdown values in Magento before import
Working with custom attributes and sets ensures your product catalog remains structured and tailored to your business. Once set up correctly, importing becomes much easier, and future updates stay consistent and error-free.
The Complete Magento 2 Product Import Checklist
1. Preparation and Data Formatting (CSV)
Create Sample File: Export a sample CSV file from System > Data Transfer > Export to understand the required structure and attribute columns.
Format Encoding: Ensure the CSV file uses UTF-8 encoding to avoid errors with special characters.
Required Fields: Confirm all mandatory fields are present: sku, attribute_set_code, product_type, name, price, categories, qty (if applicable).
Correct Separators: Use a comma (,) for the field separator and a comma for the multiple-value separator.
Map Columns: Map CSV columns to Magento attributes correctly.
Image Handling: Ensure that image names in the CSV match the filenames of the files uploaded to pub/media/import.
2. System Configuration and Preparation
Backup: Perform a complete backup of your database and media folder before importing.
Pre-create Categories: Ensure all categories listed in the CSV exist, as the default importer does not create them.
Check Attribute Sets: Ensure all attribute_set_code values exist in Stores > Attributes > Attribute Set.
Check Attributes: Create necessary custom attributes (color, size) before importing.
3. Import Settings (Admin Panel)
Navigate: Go to System > Data Transfer > Import.
Entity Type: Select Products.
Import Behavior: Choose the correct action:
Add/Update: Adds new products, updates existing.
Replace: Overwrites existing data with new data.
Delete: Removes products based on SKU.
Validation Strategy: Set to Stop on Error (safer) or Skip error entries.
Images Path: Enter pub/media/import in the Images File Directory field.
4. Validation and Execution
Check Data: Click Check Data to validate the CSV structure and check for errors before importing.
Fix Errors: If errors appear, fix them in the CSV and re-upload.
Import: If valid, click Import.
5. Post-Import
Clear Cache: Go to System > Cache Management and refresh invalid caches.
Reindex: Run reindex commands to ensure data is updated on the frontend.
Verify: Check Catalog > Products to confirm products and images are displayed correctly.
Error Handling and Debugging
Product imports in Magento 2 can sometimes fail, especially when dealing with large datasets, configurable products, or custom attributes. Understanding how to catch and resolve these issues quickly can save hours of frustration and prevent broken product listings on your storefront.
Useful Logs and Tools
Magento gives you several built-in tools to help debug and fix issues during product imports. Knowing where to find errors and how to read them can save hours of frustration.
Import History & Error Log
After an import attempt, always start by checking the Import History in the Magento Admin. Go to System > Data Transfer > Import History.
Here, you’ll see a log of past import attempts along with a downloadable error report. The error file lists which rows failed and why, helping you pinpoint exactly what needs to be fixed in your CSV.
System Logs
For deeper, more technical issues, Magento stores logs inside the /var/log/ directory of your installation. Two important files to check:
system.log – Captures general Magento system errors or warnings.
exception.log – Logs any exceptions or critical issues that occur during processes like importing.
You can access these via file manager, SSH, or your hosting panel (depending on setup). Reviewing these logs helps in spotting hidden problems that don’t show in the admin panel.
CLI Debug Commands
After you run a successful import, changes might not show on the frontend immediately. That’s because Magento caches data heavily. Run these commands to refresh everything:
php bin/magento cache:clean
php bin/magento indexer:reindex
These two commands ensure your new products or updates appear correctly across the storefront, admin, and any search filters.
Pro Tips for Debugging
Always validate your CSV before uploading using the Admin Panel’s “Check Data” feature.
Start with a small sample file before running a full import.
Keep Magento in developer mode in staging environments to get more verbose error outputs.
Debugging Magento product imports becomes a lot smoother once you’re familiar with the tools, logs, and common patterns. After taking care of the basic setup, you can consult with our Magento development company for extensive maintenance.
Common Validation Errors and Solutions
1. Missing Required Fields
Error: “Skip import row, required field ‘…’ not defined” or similar messages.
Cause: The CSV file is missing major columns like sku, name, price, qty, product_type, or attribute_set_code.
Solution: Ensure your CSV includes all mandatory columns, as this is an important step in Magento 2 import products. You can download a sample CSV file from the Magento admin panel (System > Data Transfer > Import) to see the required format.
2. Invalid Attribute Values
Error: “‘…’ is no valid value for ‘…'” or “Invalid Option Value”.
Cause: The value in your CSV (e.g., a specific color or size) does not exactly match the predefined options in your Magento store’s attributes.
Solution: Verify the attribute values in your CSV match those defined in the Magento backend under Stores > Attributes > Product.
3. Incorrect CSV Format/Encoding
Error: “Invalid file format or file format not recognized” or corrupted special characters.
Cause: The file might not be in the correct UTF-8 encoding or use the wrong field/multiple value separators.
Solution: Save your file as CSV UTF-8 (Comma-delimited). Ensure the separators used in the file match the settings specified in the Magento import product configuration.
4. Duplicate SKUs or URL Keys
Error: “Duplicate SKU found in rows: x, y” or “URL key for specified store already exists”.
Cause: Each product must have a unique SKU. URL keys must also be unique across different products or store views.
Solution: Modify the SKUs in the CSV to be unique. For URL key conflicts, define unique URL keys for the conflicting products in the CSV or add a postfix.
5. Image Import Errors
Error: “Image file does not exist: ‘…’ in row y”.
Cause: The file path in the CSV is incorrect, or the images haven’t been uploaded to the correct directory on the server (usually /pub/media/import/ or var/import/images).
Solution: Upload all images to the correct directory on your server via FTP and ensure the file names and paths in the CSV file are accurate.
6. File Size Limit Exceeded
Error: “Uploaded file size exceeds the maximum allowed limit”.
Cause: The default maximum file size in Magento is often low (e.g., 2MB).
Solution: Split your large CSV file into smaller ones or increase the upload_max_filesize and post_max_size limits in your server’s php.ini configuration.
7. Invalid Product Type or Attribute Set
Error: “Product Type is invalid or not supported” or “Invalid value in attribute_set_code“.
Cause: The product_type or attribute_set_code values in the CSV do not match the existing ones in Magento.
Solution: Check the exact names of attribute sets under Stores > Attributes > Attribute Sets and use the standard Magento product type values (simple, configurable, grouped, etc.) in your CSV file.
Let’s Summarize
Importing products in Magento 2 can feel complex at first, but once you understand the available methods, it becomes a manageable and scalable task. Each option serves a different use case depending on your technical expertise and store needs.
Taking time to properly set up your CSV, define attribute sets, and handle custom attributes ensures smoother imports and cleaner product data. Plus, using Magento’s logs and validation tools can help you catch and fix issues quickly.
If you’re managing a large catalog or planning frequent imports, our expert team can streamline the process, automate repetitive tasks, and help avoid costly errors down the line. Contact us today and see the difference yourself!
FAQs for Importing Products in Magento 2
Q1. How to Import a CSV file in Magento 2?
To import a CSV file in Magento 2:
Go to System > Data Transfer > Import in the admin panel.
Choose Entity Type as “Products”.
Select your Import Behavior (Add/Update, Replace, or Delete).
Upload your prepared CSV file.
Click Check Data to validate the file.
If there are no errors, hit Import to start the process.
Make sure your CSV includes all required fields (like SKU, name, price, attribute_set_code) and follows Magento’s format.
Q2. How do I add products to Magento 2?
There are two main ways to add products in Magento 2: Manually via the Admin Panel and Bulk Upload via Import. The manual is good for a few products. For large inventories, importing via CSV saves time and ensures consistency.
Q3. How to Import sample data in Magento 2?
If you’re using Magento 2 for testing or learning, you can import sample data to see how products, categories, and other content work. To do this via CLI:
bin/magento sampledata:deploy
Then, run:
bin/magento setup:upgrade
Q4. How to export a CSV file in Magento 2?
To export product data as a CSV in Magento 2:
Go to System
Data Transfer Export
Choose Entity Type: Products
Set any filters (optional)
If you want to export specific products
Click Continue to generate and download the CSV file
This CSV can be edited and later re-imported to update product data in bulk.