Magento – CSV Import with multiple categories and commas in category names

categorycsvimport

I have a CSV of products to import and each product has multiple categories, some with commas in the category name. To import a product and asign multiple categories, I would usually add a CSV column for _catagory and give a comma separated list of categories enclosed with double quotes:

sku,name,_category
1,Product 1,"Category 1,Category 2, Category 3"

However, if the category names have commas in them, how should I denote this in the CSV?

  • Category, 1
  • Category, 2
  • Category, 3

Perhaps escape the comma in the category name?

sku,name, _category
1,Product 1,"Category\, 1,Category\, 2, Category\, 3"

Or perhaps the only way to do this is to use the category ID rather than the name?

Best Answer

This is not how you import multiple categories. The correct way is to add a new line but without sku:

sku,name,_category
1,Product 1,Category1
,,Category2
,,Category3

As long as there is no new SKU, all lines belong to the same product.

Related Topic