Tutorial: Using Magento’s Import/Export Profiles

Contents

Although it is fairly simple to do, Magento users often encounter difficulties when attempting to use the import functionality built in to Magento software. We see a fair number of inquiries about this here at Magento Enterprise Support, so we’ve decided to write a tutorial to help you better understand how to use dataflow.

First, let’s take a look at how to create an import file, which will include all the data we want to bring into Magento. Ironically, the easiest way to learn how to import is to first do an export because exporting creates a sample comma-separated value (.csv) file you can use as a template for your import.

Note: The information in this article was verified on Magento Community Edition (CE) 1.8.0.0 and Enterprise Edition (EE) 1.13.1.0. The steps might be different for older versions.

Step 1: Exporting All Products

To export products from Magento CE or EE:

  1. Log in to the Admin Panel as an administrator.
  2. Click System > Import/Export > Dataflow - Profiles.
    The Profiles page displays available profiles. By default, Magento CE and EE ship with several default profiles. The one we'll use for this tutorial is named Export All Products.
  3. Click Export All Products.
  4. On the Export All Products page, in the left column, click Run Profile.
    The other options in the left column don't apply to this tutorial.
  5. On the next page, click Run Profile in Popup.
  6. Wait while your products export.
    The length of time varies with the number of products in your catalog. Don't interrupt the export while it's happening.
    The following message displays when all products have been exported:
    Finished profile execution.
    The following figure shows an example.
    image
  7. Look on your Magento server's file system for a file named magento-install-dir/var/export/export_all_products.csv
  8. Open this file in a plain text editor capable of UTF-8 encoding.
    Magento recommends using an application like Notepad++ because it adds no extra data to the .csv file.

    Important: Do not use a program like Microsoft Excel to open the file because it adds additional data to the .csv file that causes issues when you import it back into Magento CE or EE.

  9. The following figure shows a sample .csv file.

    image
    Click image for full-size

    Step 2: Copying Images to the Magento Server

    For the product import to work, any images required by your products must be copied to the server's magento-install-dir/media/import directory. By default this directory doesn't exist.

    To create the media/import directory manually:

    1. Log in to the Magento server as the owner of the Magento file system (typically the web server user or a user with root privileges.)
    2. Enter the following commands in the order shown:
      cd magento-install-dir/media
      mkdir import
    3. Copy your images to that directory before continuing with the next section.

    Step 3: Editing the .csv File

    Now that you have a template to work with, edit the file and add the relevant information which you would like to import.

    We now come to the most important part of the process which is often missed when saving the import file and causes many of the issues which are referred to us.

    Two things cause the most problems with import:

  • The the import file must be UTF-8 encoded to ensure that the file can be read and processed by Magento CE or EE.
    If you use Notepad++, click Encoding > Encode in UTF-8 without BOM.
  • You must set your PHP memory limit to a value that meets or exceeds Magento system requirements.
    For assistance, see the Magento installation guide.

If your products have images, use the following steps when editing the .csv file:

  1. Find a product in the export file that has images (search for .jpg or .png, for example).
    Images are typically specified similar to the following:
    "/n/o/nokia-2610-phone-2.jpg","/n/o/nokia-2610-phone-2.jpg","/n/o/nokia-2610-phone-2.jpg"
  2. Change the paths and file names like the following:
    "/myimage.jpg","/myimage.jpg","/myimage.jpg"
  3. If your product has multiple images, specify them on multiple lines. Avoid importing duplicate images.
  4. Save your changes to the .csv file and continue with the next section.

Step 4: Importing Products

To import products:

  1. Log in to the Admin Panel as an administrator.
  2. Click System > Import/Export > Dataflow - Profiles.
  3. On the Profiles page, click Import All Products.
    This option can be used to import any number of products into Magento CE or EE. You can also use it to update existing products.
  4. In the Import/Export Profile section in the left column, click Upload File.
  5. Click Browse and follow the prompts on your screen to locate the file you previously exported and edited.
  6. Click Save and Continue Edit.
  7. In the left column, click Run Profile.
  8. From the list, click the name of the file you previously uploaded.
    The following figure shows an example.
    image
    Click image for full-size
  9. Click Run Profile in Popup.
  10. Wait while your products import.
    Importing typically takes longer than exporting. Progress messages displays during the import. Don't interrupt the import while it's happening.
    The following message displays when all products have been imported:
    Imported number records.
  11. The following message displays to confirm products were imported successfully:

    image

    Last Step: Reindex

    After you import products, you'll most likely have to reindex. If a message displays at the top of the Admin Panel instructing you to update your indexes, click System > Index Management and follow the prompts on your screen to reindex. (You can also click the link in the message itself.)

    For More Information

    For more information about dataflows, see Introduction to Magento Dataflow.

Discussion:

RSS: New Article posts

Explore the Knowledge Base