Hello Magento Friends ๐Ÿ‘‹,

Today I am going to discuss How to Import CSV File to Custom Table In Magento 2. In case you skipped our previous blog, check it out here. How to Configure Flat Rate Shipping Method in Magento 2.

During the import of the product in Magento 2, some of the data or columns from the CSV file need to be imported to a custom table. So letโ€™s crack up on the implementation to Import CSV file to Custom Table in Magento 2 ๐Ÿš€

Steps to Import CSV File to Custom Table in Magento 2:

Step 1: Create an import.xml file at the following path:


Now, add the below code:

Step 2: Create file CustomImport.php under app/code/Vendor/Extension/Model/Import folder and add the following code:

Step 3: Create validator interface file RowValidatorInterface.php under app/code/Vendor/Extension/Model/Import/CustomImport folder and add the below code:

Step 4: Create custom_table with columns as ID, Title, and Description.

Step 5: Create CSV using the same columns in the admin panel. System > Data Transfer > Import. Select Custom Import in the Entity Type field.


Hence, all have successfully implemented to import CSV file to a custom table in Magento 2. In case you face any difficulty while implementing the steps, let me know in the comment part below. Share the article with your friends.

Happy Reading ๐Ÿ˜Š

[Total: 3   Average: 5/5]