How To Import/Export Categories to Magento 2

Magento 2 Development

Below, you will find a brief description of how to import/export categories between two Magento 2 websites. Unfortunately, this functionality is not available by default. Magento 2 leaves you alone with a huge category tree. You need to recreate it manually or rely on third parties. And we know for sure how to import and export Magento 2 categories most efficiently. This post was inspired by the Magento StackExchange discussion. Question by Rafael Corrêa Gomes; answer by KAndy. However, it is only a partial overview of the Magento 2 category import and export. A full-featured guide on how to import and export categories, with all attributes explained can be found here: Read full-featured Magento 2 Category import and export guide.

Magento 2 Category Import & Export

If something is not available in Magento 2 by default, you can create a module that adds the necessary functionality. Of course, it is not the easiest way to get the desired features, but it can be the only available one. Luckily, the Magento 2 ecosystem is huge and there are already lots of third-party extensions that allow to dramatically enhance the default functionality of the platform. Often it is not necessary to recreate the wheel, since someone has already developed a Magento 2 extension with the missing feature. It is even possible to get key Enterprise Edition features on a Community-based website, but what about category import/export?

There are tons of import/export solutions developed to enhance the default functionality of Magento 2. You can check our digest here: The Best Improved Import/Export Extensions for Magento 2. As for category import, there is the Bulk Categories Import / Export module by Commerce Extensions and our Improved Import extension.

Improved Import and Export of Magento 2 Categories

Improved Import and Export for Magento 2 is irreplaceable when it comes to data transfers. Be it categories or any other Magento 2 entity, the extension processes the entity specifics to the tiniest detail and allows performing flexible import and export based on the improved data transfer logic.

Download / Buy Firebear Improved Import Magento 2 Extension

As for the import functionality itself, the Improved Import Magento 2 module allows to import categories with different behavior: Add / Edit, Delete, and Replace. Thus, the tool allows you to get all the necessary data within your Magento 2 store in the most precise manner.

Moreover, Improved Import and Export support various data sources which help you increase the efficiency of your export and make data transfers highly personalized. Google Drive and Google Sheets, FTP/SFTP, REST and SOAP API, Dropbox, URL, and file upload can be import sources for your Magento 2 data.

Our Magento 2 extension works with multiple file formats, including CSV, ODS, XLSX, XML, JSON files. Import and export files have a certain table structure, you can compose such files from scratching using our sample file in the Master Category Import Table.

As you can see, it contains such attributes:

  • name – each category has a name and you can view it here;
  • url_path – the URL to a category;
  • url_key – each category has a URL key that is displayed here;
  • Description – a column for category descriptions;
  • Is_active – shows whether the category is enabled or disabled;
  • Include_in_menu – shows whether the category should be included in the main menu on the frontend;
  • Is_anchor – this parameter is necessary for layered navigation for the category;
  • custom_layout_update – custom XML layout update for the category.
  • and others that can be found in the sample Google Sheet.

As for other features available with the Improved Import Magento 2 extension, they allow setting category position and location. First of all, you can import categories by name and the full path to the category  (Default Category/Women/Dresses). Besides, it is possible to leverage parent category IDs to run the import process.

Once the extension is installed and enabled, configure the general settings for your import job. Then select the ‘Categories’ entity to import categories to your Magento 2 website from another one. After that, you may proceed with import behavior settings and import source and file format selection.

category import

Don’t forget to map the data if needed. Run the job to see your categories import done.

Download / Buy Firebear Improved Import Magento 2 Extension

More tips from Magento 2 Cookbook.

Magento 2 Category Import & Export FAQ

Let’s take a look at other nuances of importing and exporting Magento 2 categories with the help of the Improved Import & Export Magento 2 extension.

How to import and export categories to Magento 2 automatically?

If you need to move categories between Magento 2 and third-parties or other Magento 2 websites regularly, use the Improved Import & Export extension. It utilizes a cron scheduler to automate data transfers including category import and export. Create or select a schedule of updates and the module will do everything for you.

How to import categories with third-party attributes to Magento 2?

Although Magento 2 blocks the import of third-party data that doesn’t follow its requirements, you can still transfer unsuitable categories with the help of the Improved Import & Export extension. The module lets you create a mapping scheme where you match third-party attributes and values to ones used within the system. Furthermore, you can apply the same trick to categories: while importing a third-party catalog, show which external categories you want to replace with the ones that are used on your website. Furthermore, you can create new categories and map external ones to them while configuring an import job. As a result, any external data, including categories, is easily adapted to the native standards of your e-commerce website. Note that you can also apply mapping to export processes to generate the output your partners require.

How to import and export categories to Magento 2 via API?

The Improved Import & Export Magento 2 extension provides the ability to create API connections for transferring categories along with other entities. There is a dedicated section in the module’s import/export jobs where you specify the parameters necessary to sync the two systems.

How to import and export categories to Magento 2 via ODS files?

Improved Import & Export lets you move categories via ODS files. You no longer need to convert them to CSV to fit the Magento 2 requirements. You can also export data using this file format.

How to import and export categories to Magento 2 via XLSX files?

In addition to ODS, Improved Import & Export lets you move categories via XLSX files. You no longer need to convert them to CSV to fit the Magento 2 requirements. You can also export data using this file format.

How to import and export categories to Magento 2 via JSON files?

Also, Improved Import & Export lets you transfer categories via XLSX files. You no longer need to convert them to CSV to fit the Magento 2 requirements. You can also export data using this file format.

How to import data to Magento 2 via compressed files?

If your files with categories are compressed, you can transfer them to Magento 2 with the help of the Improved Import & Export extension. Remember that your file archive should be in a ZIP or TAR format. Our module supports compressed CSV, XML, ODS, JSON, and XLSX files.

How to import data to Magento 2 from Google Sheets?

If categories are stored in Google Sheets, it is no longer a problem. The Improved Import & Export extension eliminates the necessity to export them from the service, convert them to CSV, and then transfer the output to Magento 2. Instead of that, you just move the corresponding information straight from Google Sheets to your e-commerce website. It is only necessary to specify the address of the corresponding data table. The corresponding export processes are possible too.

How to import and export categories to Magento 2 from Dropbox?

The Improved Import & Export module lets you move categories to Magento 2 from Dropbox. You can store them there in CSV, JSON, XML, ODS, or XLSX files or ZIP and TAR archives. You can also use this file storage as your export destination.

How to import and export categories to Magento 2 from Google Drive?

In addition to Google Sheets and Dropbox, the Improved Import & Export extension provides the ability to import and export categories between Magento 2 and Google Drive. You can store them there in CSV, JSON, XML, ODS, or XLSX files or ZIP and TAR archives.