Magento 2 tutorials

How to csv Export or Import Customers data in Magento 2

Pinterest LinkedIn Tumblr

Magento 2 has a built-in function that allows store-owner to export and import customers’ data. This is very helpful if you want to transfer your customers’ data to another store, or store your customers data for other purposes.

Previously, I published a tutorial on how to csv import product in Magento 2. In this tutorial, we will learn how to import and export customers data with csv file in Magento 2

Export customers data in Magento 2

In this part, I will explain how to export customer data to a CSV file.

Step 1: In Magento 2 admin dashboard, go to System > Data Transfer > Export

export customers magento 2

Next, in Entity tyle select Customer main file

export customers magento 2 setting

Step 2: Include or exclude customers attribute from the exported csv file

In the Entity Attributes tables, you can choose to include or exclude a specific attribute from the exported csv file.

export customers entity attributeFor example, if I want to export only female customer, in Gender attribute, I will select Female, note that the exlucded value will still appear in export file but with no value.

select female atrribute

If you want to enclose any special characters that might be found in the data as an escape sequence, select the Fields Enclosure checkbox.

Step 3: Start to export file

When you finish choosing attributes, click on continue button at the bottom of the page to start importing customer CSV file

click on continue

Once finishing, if you are using Magento 2.3, you will receive a CSV file contain all the customer information you select in Step 2, open the file and you will see information as below

customer export files magento 2

If you are using Magento 2.4, you will see the message

Message is added to queue, wait to get your file soon. Make sure your cron job is running to export the file
Message is added to queue, wait to get your file soon.
You can get export file in var/export/ folder

Import customer data in Magento 2

We can also import customer data using CSV file, the customer information will be fully loaded to your store.

Step 1: Select import options

On the Admin dashboard, go to System > Data Transfer > Import

import customer data magento 2

Next, in Entity field, select Customer Main File 

import customer main file

In Import behavior section, choose among the following behaviors:

  • add/Update complex data: New customer data is added to the existing customer data for the existing entries in the database
  • delete entities: Any entities in the import data that already exist in the database are deleted from the database.
  • custom action: define your own import behavior

Please be careful when selecting Import behavior.

In Validation strategy, define action the system will take when encounter error on importing

validation strategy

  • Stop on Error: The import process will stop if there’s any error
  • Skip error entries: The import process will continue even there’s error.

Step 2: Choose file to import

Now we will prepare a file with proper format to import. If you don’t know the proper format of a customer main file, click on download sample file in Entity type section to get the sample file.

download sample file

Make sure your customer CSV file format looks like this:

customer import file magento 2

After you have prepared the data, go to File to import section and click on Select file to import and choose your file to start the import process

file to import

Finally, click on Check Data button to validate the import file

validation results

If the file is valid, click on Import button to start the import process

If you see this error page after clicking on Import button, recheck your file according to error message

import error

Wrapping up

If you have any problem during the export/import process, please drop a comment below describe your issue (better with a screenshot). I will be happy help you solve the issue.

Hope this tutorial is helpful for you.

Hung Tran is the main editor of magentip.com, he loves to write about everything related to Magento 2

Write A Comment