cancel
Showing results for 
Search instead for 
Did you mean: 

Importing tablerates.csv Issue

SOLVED

Importing tablerates.csv Issue

I'm trying without success to import tablerates.csv file after populating it with the necesary data. But I get errors each time it seems as if Magento 2 doesn't recognize Nigerian Regions/States, as the following states:

We couldn't import this file because of these errors: Please correct Region/State "ABIA" in the Row #2.
Please correct Region/State "ABUJA" in the Row #3.
Please correct Region/State "ADAMAWA" in the Row #4.
Please correct Region/State "AKWA-IBOM" in the Row #5.
Please correct Region/State "ANANBRA" in the Row #6.
Please correct Region/State "BAUCHI" in the Row #7.
Please correct Region/State "BAYELSA" in the Row #8.
Please correct Region/State "BENUE" in the Row #9.
Please correct Region/State "BORNO" in the Row #10.
Please correct Region/State "CROSS-RIVER" in the Row #11.
Please correct Region/State "DELTA" in the Row #12.
Please correct Region/State "EBONYI" in the Row #13.
Please correct Region/State "EDO" in the Row #14.
Please correct Region/State "EKITI" in the Row #15.
Please correct Region/State "ENUGU" in the Row #16.
Please correct Region/State "GOMBE" in the Row #17.
Please correct Region/State "IMO" in the Row #18.
Please correct Region/State "JIGAWA" in the Row #19.
Please correct Region/State "KADUNA" in the Row #20.
Please correct Region/State "KANO" in the Row #21.
Please correct Region/State "KATSINA" in the Row #22.
Please correct Region/State "KEBBI" in the Row #23.
Please correct Region/State "KOGI" in the Row #24.
Please correct Region/State "KWARA" in the Row #25.
Please correct Region/State "LAGOS" in the Row #26.
Please correct Region/State "NASARAWA" in the Row #27.
Please correct Region/State "NIGER" in the Row #28.
Please correct Region/State "OGUN" in the Row #29.
Please correct Region/State "ONDO" in the Row #30.
Please correct Region/State "OSUN" in the Row #31.
Please correct Region/State "OYO" in the Row #32.
Please correct Region/State "PLATEAU" in the Row #33.
Please correct Region/State "RIVERS" in the Row #34.
Please correct Region/State "SOKOTO" in the Row #35.
Please correct Region/State "TARABA" in the Row #36.
Please correct Region/State "YOBE" in the Row #37.
Please correct Region/State "ZAMFARA" in the Row #38.

 

The regions and states are valid in Nigeria.

 

I would appreciate any help on how to fix this issue. Thanks a million in advance.

3 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Importing tablerates.csv Issue

Hi @FlamyTech,

 

Are those regions into the database? Maybe you will need to insert first the Negerian regions?

View solution in original post

Re: Importing tablerates.csv Issue

You can add the new state to the country as per below link, Given link is for Indian states but you can change as per your requirement, Nigerian state and do the same procedure for your country.

how-to-add-new-region state-in-magento

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

Re: Importing tablerates.csv Issue

When is someone going to suggest backing up the database first?  When is a reference to the user's guide for importing table rates going to be suggested?

 

Back-up your database, don't follow anything that is referencing M1.x unless it is specifically shown to be working with M2.x.  Refer to: http://docs.magento.com/m2/ce/user_guide/shipping/shipping-table-rate.html

View solution in original post

16 REPLIES 16

Re: Importing tablerates.csv Issue

Hi @FlamyTech,

 

Are those regions into the database? Maybe you will need to insert first the Negerian regions?

Re: Importing tablerates.csv Issue

@Damian Culotta, thanks for stopping by.

 

No, those regions/states are not in the database. I didn't even know one has to add them before Magento 2 accept them as valid.

 

Please, can you give me a detailed guidelines on how to add them to the database?

Re: Importing tablerates.csv Issue

You can add the new state to the country as per below link, Given link is for Indian states but you can change as per your requirement, Nigerian state and do the same procedure for your country.

how-to-add-new-region state-in-magento

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Importing tablerates.csv Issue

@Rakesh Jesadiya a million thanks for your input.
I followed the guidelines on that given blog post to create the two necessary CSV files. But I got an error message, when I tried to import the "directory_country_region.csv" file, which I created:

Error

SQL query:

INSERT INTO `directory_country_region`
VALUES (
'31', 'NG', 'AB', 'Abia'
)

MySQL said: Documentation
#1062 - Duplicate entry '31' for key 'PRIMARY'

In phpMyAdmin's "directory_country_region" table, the number 30 is the last in "region_id" column. So, I started my numbering at 31.

Please, see  the "directory_country_region.csv" :

31	NG	AB	Abia
32	NG	FC	Abuja
33	NG	AD	Adamawa
34	NG	AK	Akwa Ibom
35	NG	AN	Anambra
36	NG	BA	Bauchi
37	NG	BY	Bayelsa
38	NG	BE	Benue
39	NG	BO	Borno
40	NG	CR	Cross River
41	NG	DE	Delta
42	NG	EB	Ebonyi
43	NG	ED	Edo
44	NG	EK	Ekiti
45	NG	EN	Enugu
46	NG	GO	Gombe
47	NG	IM	Imo
48	NG	JI	Jigawa
49	NG	KD	Kaduna
50	NG	KN	Kano
51	NG	KT	Katsina
52	NG	KE	Kebbi
53	NG	KO	Kogi
54	NG	KW	Kwara
55	NG	LA	Lagos
56	NG	NA	Nasarawa
57	NG	NI	Niger
58	NG	OG	Ogun
59	NG	ON	Ondo
60	NG	OS	Osun
61	NG	OY	Oyo
62	NG	PL	Plateau
63	NG	RI	Rivers
64	NG	SO	Sokoto
65	NG	TA	Taraba
66	NG	YO	Yobe
67	NG	ZA	Zamfara

Please, see the "directory_country_regions_name.csv" code:

en_gb	31	Abia
en_gb	32	Abuja
en_gb	33	Adamawa
en_gb	34	Akwa Ibom
en_gb	35	Anambra
en_gb	36	Bauchi
en_gb	37	Bayelsa
en_gb	38	Benue
en_gb	39	Borno
en_gb	40	Cross River
en_gb	41	Delta
en_gb	42	Ebonyi
en_gb	43	Edo
en_gb	44	Ekiti
en_gb	45	Enugu
en_gb	46	Gombe
en_gb	47	Imo
en_gb	48	Jigawa
en_gb	49	Kaduna
en_gb	50	Kano
en_gb	51	Katsina
en_gb	52	Kebbi
en_gb	53	Kogi
en_gb	54	Kwara
en_gb	55	Lagos
en_gb	56	Nasarawa
en_gb	57	Niger
en_gb	58	Ogun
en_gb	59	Ondo
en_gb	60	Osun
en_gb	61	Oyo
en_gb	62	Plateau
en_gb	63	Rivers
en_gb	64	Sokoto
en_gb	65	Taraba
en_gb	66	Yobe
en_gb	67	Zamfara

Do you or anyone else have any insight why phpMyAdmin flags 31 as a duplicate entry?

Thanks in advance for your help.

Re: Importing tablerates.csv Issue

You dont need to add flag in your csv because id is auto increment field so Its automatically takes next number in table so just remove id field from both csv and check again.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Importing tablerates.csv Issue

@Rakesh Jesadiya, I deleted that id field, and got a new error message:

Invalid column count in CSV input on line 1.

Any idea why this happened? See the screenshot below for "directory_country_region.csv" after removing the id:

directory_country_region.png

Re: Importing tablerates.csv Issue

@Rakesh Jesadiya, @Damian Culotta,

At a second check of the "directory_country_region" and "directory_country_region_name" tables, I realized that the last "region_id" is 511. So, I started with 512. I successfully imported the "directory_country_region.csv" and "directory_country_region_name.csv" to the appropriate tables via phpMyAdmin. Then, I tried importing "tablerates.csv" into Magento admin, but I got the following error message again:

We couldn't import this file because of these errors: Please correct Region/State "Abia" in the Row #2.
Please correct Region/State "Abuja" in the Row #3.
Please correct Region/State "Adamawa" in the Row #4.
Please correct Region/State "Akwa Ibom" in the Row #5.
Please correct Region/State "Anambra" in the Row #6.
Please correct Region/State "Bauchi" in the Row #7.
Please correct Region/State "Bayelsa" in the Row #8.
Please correct Region/State "Benue" in the Row #9.
Please correct Region/State "Borno" in the Row #10.
Please correct Region/State "Cross River" in the Row #11.
Please correct Region/State "Delta" in the Row #12.
Please correct Region/State "Ebonyi" in the Row #13.
Please correct Region/State "Edo" in the Row #14.
Please correct Region/State "Ekiti" in the Row #15.
Please correct Region/State "Enugu" in the Row #16.
Please correct Region/State "Gombe" in the Row #17.
Please correct Region/State "Imo" in the Row #18.
Please correct Region/State "Jigawa" in the Row #19.
Please correct Region/State "Kaduna" in the Row #20.
Please correct Region/State "Kano" in the Row #21.
Please correct Region/State "Katsina" in the Row #22.
Please correct Region/State "Kebbi" in the Row #23.
Please correct Region/State "Kogi" in the Row #24.
Please correct Region/State "Kwara" in the Row #25.
Please correct Region/State "Lagos" in the Row #26.
Please correct Region/State "Nasarawa" in the Row #27.
Please correct Region/State "Niger" in the Row #28.
Please correct Region/State "Ogun" in the Row #29.
Please correct Region/State "Ondo" in the Row #30.
Please correct Region/State "Osun" in the Row #31.
Please correct Region/State "Oyo" in the Row #32.
Please correct Region/State "Plateau" in the Row #33.
Please correct Region/State "Rivers" in the Row #34.
Please correct Region/State "Sokoto" in the Row #35.
Please correct Region/State "Taraba" in the Row #36.
Please correct Region/State "Yobe" in the Row #37.
Please correct Region/State "Zamfara" in the Row #38.

What else can I do to successfully import the tablerates.csv? Thanks in advance.

Re: Importing tablerates.csv Issue

When is someone going to suggest backing up the database first?  When is a reference to the user's guide for importing table rates going to be suggested?

 

Back-up your database, don't follow anything that is referencing M1.x unless it is specifically shown to be working with M2.x.  Refer to: http://docs.magento.com/m2/ce/user_guide/shipping/shipping-table-rate.html

Re: Importing tablerates.csv Issue

@df2k2, thanks for the pointer.

 

I actually followed the guidelines on the Magento Docs when I was hit by the issue. And then, the suggestions to add those regions in the database first came up. Ok, without first adding the Nigerian regions/states to the database, how will Magento recognize them?

 

I have a strong feeling that you're the same person who is responding to my thread about the same issue on the Stack Exchange Network. I deeply appreciate your time and input.