In default Magento 2, admin can process some significant actions more quickly and directly with import and export functions such as Advance Pricing, Products, Customers and Addresses (single file), Customer Main File and Customer Addresses.
In this blog post, we will introduce you a full guideline on how to import and export products via a CSV file so that all of you can do by yourself without depending on IT staff.
Import Products into Magento 2 Websites
To import products in Magento 2, you navigate to Admin Dashboard → System → Data Transfer → Import.
In Import Settings: you choose Products in the drop-down list of Entity Types section. Then there are many other settings appearing for you to make configuration.
Step 1: Prepare a CSV file including product data
As mentioned before, you can easily add products in bulk via a CSV file. Therefore, the very first thing you need to do is to prepare a standard CSV file with all necessary information about products. Default Magento 2 supports you this issue by providing the sample file to download, which can help you follow available examples and avoid errors while filling in data.
You click “Download Sample Data” next to Entity Types section.
The CSV file will be saved in your computer. Let’s open the file and start finishing your product data in columns and rows of the file.
- For product data including paths of product images, make sure that you have uploaded the image files to the appropriate location. The default location on the Magento server is pub/media/import.
- The size of the CSV file does not exceed 2M.
Step 2: Configure Import Behaviors
In Import Behavior, there are 3 options for you to select depending on your purposes to import data:
- Add/ Update: Add new data to the existing product data for the current entries in the database and update all fields except for SKU. Moreover, new tax classes, new product categories and new SKUs that are specified in the CSV file are also automatically created.
- Replace Existing Complex Data: Replace the existing data with the new ones. In case SKUs in the CSV file is similar to SKU of the existing entity, all fields are deleted, and a new record is created using data in the import file.
- Delete Entities: Delete every entity in the CSV which already exists in the database
Also, you can also determine how the system will process when errors occur:
- Stop on Error: the system stops importing when there are errors.
- Skip error entries: the system skips errors and continues to import.
In Allowed Errors Count: This setting allows you to choose the allowed maximum number of errors when importing. If the number of errors happening in the import process exceeds that maximum number you fill in this field, the system will stop importing.
In Field separators: fill in a character to separate fields. Magento accepts the default value of a comma.
In Multiple value separators: Magento also accepts the default value of a comma.
*Note: If you want to change into another character as a separator, make sure that it has to match with the one you use in the CSV file.
Step 3: Upload the import file
You click Choose File to select the wanted import file and upload it.
For Images File Directory section: It will be used in case you have import date including paths of product images. Let’s choose one of the following options to enter into this field:
- The path to the uploaded images on the Magento server. For example: var/import.
- The full URL to the images on another server
Step 4: Check the import data
After you finish all of the above things, the last one you need to do is validate the import data by clicking Check Data button.
- If your CSV file is free from errors, there is a message to notify validation results, and Import button now appears to click. You click the Import button to start importing product in the CSV file into Magento 2 website.
- If your CSV file includes errors, the Import button cannot be displayed for you to click and there is a notification about these problems
Export Products with Attributes
Default Magento 2 also allows you to export products with selected attributes by going System → Data Transfer → Export.
In Entity Types: you choose Products in the drop-down list
You can see a grid table of product attributes in the Entity Attributes section. By the default, the system will export all of these available attributes if you don’t perform more actions. However, you can choose to exclude unnecessary attributes by ticking in boxes before them.
Then, click the Continue button, and as a result, you will export wanted attributes in a CSV file.
This is the full guideline to import and export products in Magento 2. Moreover, to quickly import and export product attributes into Magento 2 websites, we can try this extension: Magento 2 Import/Export Product Attributes or other Magento 2 Import Export extensions you may take more concerns for your websites:
- Magento 2 Import Export Product Reviews Extension
- Magento 2 Import Export URL Rewrites Extension
- Magento 2 Import Export Wishlist Item Extension
- Magento 2 Import Export Categories Extension
- Magento 2 Import Export CMS Page Extension