How to Import Attribute Values with Commas to Magento 2 

- E-Commerce, Fire development, Magento 2

Magento 2 import export debug log

In the following article, we describe a basic but critical situation: while you import a data file to Magento 2, an attribute value that contains commas is separated into multiple parts or transferred partly while you need an undivided value. Below, we describe why it happens and propose a solution. Besides, you will see how to import attribute values with commas more efficiently, avoiding other issues and errors.

'

The Issue

Bullseye describes the following situation in this StackExchange topic. The Magento 2 user tries to import a CSV file into the system. The file includes an additional_attribute field. Its values contain commas. After import, all of them get cut off after the first comma. 

It is a common issue that may happen if you are not familiar with Magento 2. However, the default import tool offers a mechanism that prevents the problem. Let’s see how to import attribute values with commas to Magento 2 with no headaches. 

The Solution

Of course, you may try to modify your import file, replacing commas. However, there is a more straightforward solution. According to JohnHughes1984, you can change a separator used for the column associated with the issue. Go to an import screen and change the value in the ‘Multiple value separator’ field. By default, it is a comma. 

You can replace ‘,’ with ‘;’ or other separators to import the full content of your attribute correctly. 

This simple step solves the issue and lets you import attribute values with commas without losing any data. But we know a more efficient way to achieve the same goal. While the solution to the problem is the same, the additional opportunities are much more extensive. If you want to import attribute values with commas to Magento 2 automatically or even transfer third-party and custom attributes into the system, proceed to the next chapter. We describe an alternative import solution there. 

How to Import Attribute Values with Commas to Magento 2 Automatically

Meet the Improved Import & Export extension! This Magento 2 module dramatically enhances the default import and export functionality of the platform, providing lots of features that are not available by default. The extension lets you specify a multiple value separator to import a data file that contains attribute values with commas.

As you can see from the screenshot above, it is also possible to specify alternative separators for categories and category levels. But what about automated data import? 

The Improved Import & Export Magento 2 extension provides the ability to automate data transfers. With this module, you can create cron-based schedules or use triggers to launch import/export processes automatically. The former lets you choose a predefined value or create a custom interval. Next, the extension does all the work for you. The configuration of the automation looks as follows: 

Magento 2 CMS Blocks

How to Import Third-Party Attributes With Values That Contain Commas to Magento 2

When it comes to third-party attributes, you cannot transfer them to Magento 2 using the default import tools. It is necessary to edit a data file before going any further. However, you can freely import them with the help of Improved Import & Export. The extension lets you apply mapping presets to make an external output suitable for Magento 2. To import values of third-party attributes that contain commas, you also have to specify an alternative multiple value separator, as mentioned above. 

After everything is configured, Improved Import & Export replaces all third-party attributes with ones used internally in a fully automated manner. As for values with commas, they are transferred undivided. Your role in this process is reduced to a few clicks. For instance, selecting a preset is shown below:

Alternatively, you can perform the same operation manually. The Improved Import & Export extension offers an interface where you match all third-party or custom attributes to ones used internally. Select a third-party attribute and specify a replacement. That’s it.

It is also possible to map and edit attribute values. Our module lets you merge or split them in bulk if necessary. And you can match external categories to ones used internally. 

And when a data file lacks some attributes, you can create them on the fly. Use a general form to specify parameters that enable the module to generate the missing data.

Other Import Improvements

Now, let’s see what core benefits the Improved Import & Export Magento 2 extension offers over the native import tools:

  • All common import issues associated with the default tool are fixed.
  • Our extension offers much higher performance and speed, even for large data files. The module splits data into segments to use less resources.
  • The Improved Import & Export plugin works with a broader range of entities. It covers not only products and customers but also orders, categories, B2B, MSI, etc.
  • In addition to CSV, our module supports a bunch of other formats. It is possible to import data files from Dropbox, FTP, and SFTP. Furthermore, you can also use Google Sheets and API to import data.
  • We update our extension with 20+ changelog items per year.
  • No custom or third-party attribute naming can prevent you from importing data to Magento 2. With our extension, you can easily make third-party data files compatible with Magento 2.
  • When it comes to export processes, the module lets you provide your partners with relevant data they need.
  • It is possible to manage import and export processes in the backend or via CLI.
  • Check the explicit documentation to find any information about the extension. 

Let’s compare Improved Import & Export to competitors. Our extension is better due to the following moments:

  • You get it for a one-time purchase: no SAAS, recurring payments, or IPAAS models.
  • Due to the module’s open code, you can freely create a custom Magento 2 import solution based on our module.
  • The extension is installed on your Magento 2 store, so you can fully control all the associated data flows.
  • The module covers numerous use-cases from migration to warehouse management entirely. 
  • You also ger a support period with our extension. We consult, assist, and do small customizations.
  • Due to the API support, you can connect your e-commerce website with any CRM, ERP, PIM, or other external systems.
  • Our module doesn’t conflict with Magento 2 or third-party extensions.
  • We implement only the best coding practices.

With Improved Import & Export, you can effortlessly transfer the following entities:

  • Products;
  • Categories;
  • Customers and Addresses;
  • Advanced Pricing;
  • Product Attributes;
  • Orders;
  • CMS Pages;
  • CMS Blocks;
  • Catalog & Cart Rules;
  • Gift Cards;
  • Reviews;
  • URL Rewrites;
  • Search Terms and Synonyms;
  • Widgets;
  • Page Hierarchy.

As for supported file formats, they include CSV, XML, Json, XLSX, ODS, and ZIP & TAR. Thus, you no longer need to convert tables to CSV to import them into Magento 2. It is also possible to transfer XML files with the help of XSLT. As for the JSON support, it enables the ability to run REST API transfers.

Besides, the extension offers support for Excel and OpenOffice so that you can import XSL, XSLX, and ODS tables. And the Improved Import & Export Magento 2 extension eliminates the necessity to extract data files from an archive before importing them to Magento 2 due to the support for ZIP & TAR files.

As for the sources where you can keep your data files before import, they include:

  • REST and SOAP API;
  • Google Sheets;
  • Direct URL;
  • FTP/SFTP;
  • Dropbox;
  • Direct File Upload.

Final Words

Importing attribute values with commas to Magento 2 is a basic task that can be completed even if you use the default Magento 2 tools. However, you can dramatically improve other aspects of the procedure with the help of Improved Import & Export. Just specify a multiple value separator and configure other parameters. Remember that you can fully automate the import process, transfer data with third-party attributes, and replace the standard file flow with API connections. For further information, follow the link below:

Get Improved Import & Export Magento 2 Extension

'