How to Import Customer with multiple address & contact

When we import Customer to ERPNext, we have to do three steps:

  1. Import Customer
  2. Import Address
  3. Import Contact

When we have customer list with a lot of sames names like below (for example, John are two different Johns, whereas Jack is the same person)
Name Address Contact
John Street 1 622 123
John Street 2 0812 345 678
Jack Street 3 722 0437
Jack Street 4 0877 123 445

in ERPNext, when we import with same Name,
then the ID will be like this
Jack (there is no Jack-1 because it’s the same person, i only import 1 record)

Then go to Step 2 & Step 3,
If I don’t know what’s the primary key of the names, how can I make street 1 to go to John and street 2 to go to John-1? and both street 3 & street 4 go to Jack?

The same also with Step 3.

If I only have 4 records, we can do it manually. But if we have 2,500+ records, we need to find automated way to do this from the Data Import Tool or maybe MySQL tool like phpmyadmin?
We have some ideas, but stuck how to link it & also how to use phpmyadmin to generate the auto numbers generated by the address title, something also like John, John-1, etc.

Can someone advise with this batch processing?

Thank you in advance.

1 Like

You will see below fields in Address and Contact.

Use these to map addresses and contacts to Customer.

1 Like

Thanks for your reply, Pawan.

I’m aware this can be done when going to each Address & Contact record and link manually.

However, I’d like to do it in batch because we have thousands of records with multiple address / branches.

Can we do it from batch like Data Import Tool or maybe SQL scripts?

This is available in Data Import Tool as columns. You can do it from there. I have done it many times previously.

I’m wondering how you do the matching.

We can successfully do import, but we’d like to match thousand of address / contact records to the correct customer IDs automatically, not by inputting one by one

1 Like

Did you find any way to import customer with multiple address and contact
if you found a solution please help men
thanks in advanced

So here I am, four years later, and still cannot seem to find the right solution to the issue. We have around 9k addresses to import (customers, suppliers, employees), most companies don’t have a multitude of data, but we have a few that have literally dozens of contacts and addresses linked to them. Are there any recent news in this field, mostly for v.12, but I will probably switch over to v.13 as soon as it’s out, ERPNext won’t go into production use before autumn here, if needs be even in spring 2022!

It is the same problem of all ERP, a distinctive code is handled only at a low level. What must be done is to implement a Rest API in a loop, through the contacts and clients are created, they are assigned.

Are you able to give us any pointers on how you match up imported addresses with contacts?

I’ve imported multiple addresses like this :

Hope it helps :laughing:

Link DocType and Link Name can be used to map the addresses to the customers using data import tool. Hope this resolves your issue.

1 Like

That was very helpful - thank you @EugeneP! That’s the most help I’ve found on the import process to date! I still have questions though.

In step three, you say:

I believe you are refering to this section of the Map Columns document:

My confusion stems from two things:

  1. I don’t know the Link Name at the time of import, because it is generated by ERPNext during the Contact/Customer/etc. import process. That makes it very time consuming to use when mapping addresses.
  2. The Link Title can be inaccurate, because different people can have the same name and hence, have two different entries in ERPNext. Assuming that the Link Title is unique would lead to associating some addresses with the wrong Contact/Customer/etc, and leave other Contact/Customer/etc without an address at all.

Am I missing something?

Maybe I can help a bit…

The “Link Name” can be set manually. In the instructions given in the @EugeneP post you quoted, he is instructing you to build the “Contacts” and the “Supplier” import tables first. Then use the magic of something like MS Excel or “LibreOffice Calc” to build the “Address” import table using the template you get from the import tool. In the Address template there will be a column called something like “Link Name”

Again, using the magic of one of the spreadsheet programs, populate the “Link Name” column in the Address template with the actual full names of the “Supplier” or “Customer” and save the template.

Then import first the Suppliers, then import the Customers, and finally import the Addresses. The Link Name column should then correlate the addresses to the correct suppliers and contacts.

Doing it this way also makes it very easy to locate the addresses properly in the GUI when your users are attempting to locate and modify any particular address because they can search by exact name.

However, even though all of this works, I do not know if it actually addresses the problem posed by the original posted several years ago when they run into multiple contacts with the exact same name.

Most likely the way to deal with that is to have the import tool report errors and continue with adding records. At the end use the list of errors to manually fix the ones that have the exact same name. I cannot imagine there would be any great number of those. Regardless, this would likely be the best fix.

Hope this helps… :sunglasses:



It did help. I was able to run a (mostly) successful test import, and I was even able to import contacts in the same manner. I did run into two problems, however:

  1. Some of my contacts have multiple phone numbers and/or email addresses, but there was only field I could use to import the data. Again, not an issue for short lists, but impractical for lists of thousands.
  2. Before importing the addresses or contacts, I can’t select a primary address or contact on the customer. Of course, importing the addresses and contacts doesn’t alter the customer record. It sounds like I need a second import after the addresses and contacts are in place to select the primary records on the customer. Is that correct?

Your thoughts?

Hello @ebsjbulcher

Am I correct in assuming you want to import the customer first, before the address or contact, but at such time also specify which of the succeeding addresses or contacts, although not imported (ie non-existent) as yet, will be the primary address or contact?

If this is what you anticipate, then I suppose you’re right in the sense that you’d have to do a subsequent import after the initial import of both customer and address/contact. However this final import is not for new records but and update. In which case export at least the ID column of the customer and the Customer Primary Address / Primary Address columns. I have never tried this but I presume you’d have to supply the ID of the address in these columns. Furthermore I have no idea as to how these 2 columns differ.

Yes, that’s correct. Thanks for the reply!

Thanks, worked like a charm.

I may add, just in case, to not put the ID for the address as this messes up and gives an, logical, error for duplicate id key or already existing id key.