Magento product import: from a supplier spreadsheet to a CSV that passes Check Data
A supplier’s spreadsheet lists a duvet cover once, with Sizes: Double/King in one cell. Magento’s importer wants a row per size, attribute codes for headings, values each attribute already lists and category paths that start at the root. Here are the Import page’s settings, what each behaviour does to products already in your store, the columns that matter, two places where Adobe’s own pages disagree, and one simple and one configurable product before and after.
Have a supplier file like this? Send it exactly as it arrived and see the same products before and after.
What a Magento product import expects
A supplier’s spreadsheet lists a linen duvet cover on one row, with Sizes: Double/King in one cell and £69/£79 in the next. A Magento product import cannot take that row as it stands. It wants a row for each size, each a simple product with its own SKU, and a configurable product row that holds them together, with a configurable_variations cell reading sku=LDC-GRY-D,size=Double|sku=LDC-GRY-K,size=King.67
The import runs from one screen in Magento Open Source and Adobe Commerce alike: System > Data Transfer > Import, with Entity Type set to Products.111 It reads a CSV, or a ZIP holding one, and “Each column heading corresponds to the Attribute Code of the field”.3 In Adobe’s attribute reference, “the sku is the only required value”, and a file can carry “only the columns with changes”.2
A new product needs more. Validation checks that every attribute the store requires has a value, and Adobe’s walkthrough for a simple product asks for a product type, an attribute set, a Product Name, a SKU and a Price.410 In the file, those are product_type, attribute_set_code, name, sku and price.2
So the work is in the spreadsheet, not on the import screen. It is the Magento end of product data enrichment.
The Import page and what Check Data checks
Adobe’s steps run in order: set Entity Type to Products, click Download Sample File, choose the behaviour and what happens on an error, choose the file, click Check Data and, if the file is valid, Import.1
| Setting | Default or choices | What it means for a supplier file |
|---|---|---|
| On an error | Stop on Error or Skip error entries | Skip error entries leaves invalid rows out |
| Allowed Errors Count | 10 | Errors allowed before the import is cancelled |
| Multiple value separator | A comma | Splits several values in one cell, such as category paths |
| Empty attribute value constant | The value the screen shows | Written in a cell, it empties that value12 |
| File | CSV, or ZIP holding a CSV; 2 MB by default | The Import page shows the server’s own limit |
Check Data is the step that matters. It checks that each heading matches an attribute, that each value meets its attribute’s data type (decimal, integer, varchar, text or datetime), that values for drop-down and multiple select attributes “exist in the defined set”, and that a new product has its required values.4
Adobe’s Import API reference, for a REST import exclusive to Adobe Commerce that it says mirrors the Admin’s, is plain about skipped errors: valid rows are imported, but once errors pass the allowed count, “the import is halted (even valid rows will not be processed)”.12 Import History, under the same menu, keeps each run with an error file to download.1
Add/Update, Replace and Delete
Rows are matched to products by SKU, and the behaviour decides what a match does.1
| Behaviour | A SKU already in the store | A SKU not in the store | Watch for |
|---|---|---|---|
| Add/Update | Updated; every field but sku can change | Created | New categories are created too |
| Replace | Deleted, then created again from the row | An error | All references in the system are lost |
| Delete | Deleted | An error | Every column but sku is ignored |
Add/Update is the one for a supplier file, with two habits to know. It creates what it does not recognise: “New product categories that are specified in the import file are created automatically”, and new SKUs are too.1 It also cannot take a value out of a field that holds several: “Multiple field values, such as websites or categories, cannot be removed using the Add/Update import behavior.”1 A product filed in the wrong category stays there after the next import.
Replace is not a stronger update: a matching product loses “all fields, including the SKU” and is created again from the row.1 On a large catalogue, leave categories and url_key out of any update that is not changing them, because either column makes the import regenerate URL rewrites “for every product in the file”.1
The columns that matter
In Adobe’s attribute reference, the sku “should be the first column, but the order of the rest of the attributes doesn’t matter”.2
| Column | What goes in it | The trap |
|---|---|---|
| sku | The product’s code, up to 64 characters | Longer codes make the import fail |
| attribute_set_code | An attribute set the store has, such as Default | Cannot be changed by import later |
| product_type | simple, configurable, grouped, virtual or bundle | Sizes need configurable and simple rows |
| categories | The path from the root: Default Category/Bedding/Pillowcases | An unknown path becomes a new category1 |
| product_websites | Website codes, such as base | Several take a comma and no space |
| name | The product name | The default url_key is made from it |
| price | A bare number, as Adobe’s sample file writes it | Not £29.0013 |
| weight | A bare number | The store’s Weight Unit is lbs or kgs9 |
| product_online | 1 for enabled, 2 for disabled | Adobe lists no other value |
| visibility | Catalog, Search; or Not Visible Individually | The second keeps a product out of listings |
| additional_attributes | Pairs of code=value, separated by commas | Codes, not labels; listed values for drop-downs |
| configurable_variations | Each simple product’s sku and values | Configurable rows only |
| base_image, small_image, thumbnail_image, additional_images | A file name in the import folder, or a full URL | The file must be there when the import runs5 |
One rule there depends on which Adobe page you read. For a product in several categories, the attribute reference says to “separate each path with a pipe”.2 The CSV page, the Import API reference and the Import page’s own default split them with the multiple value separator, a comma, and Magento’s sample import file writes “Default Category/Gear,Default Category/Gear/Fitness Equipment”.312113 Export a product in two categories and copy what your store writes.
Where supplier files break it
These faults all arrive in the supplier’s spreadsheet, and Check Data names most of them.
Headings in the supplier’s words. Product Name, Colour, RRP. Each heading is read as an attribute code, and codes are created “in lowercase characters and without spaces”: name, color, price.38 A heading that matches nothing loses its column: the attribute “is not created and its values are not imported”, and “Imported attribute %attribute name% does not exist in the system.” is among Adobe’s validation messages.14 Supplier data onboarding sets out the map.
Category paths from the supplier’s tree. Bed Linen > Pillowcases. The path Magento wants “includes the root category, followed by a forward slash (/) between each level”: Default Category/Bedding/Pillowcases.3 Under Add/Update an unknown path is created rather than refused, so a misspelt Beding becomes a new branch of your tree.1
Sprawl is quicker to build than to undo: our own first pass spread one bathroom retailer’s 62 wall panels over 15 categories, sofas among them, before we brought them into one range. Mapping supplier categories comes before the path syntax.
Values the attribute does not list. The store’s color attribute lists Grey; the supplier writes Gray, Gry and Grey/Charcoal. Values for drop-down and multiple select attributes are checked against the attribute’s list, and “Value is not allowed. Attribute value does not exist in the system.” is among the messages.4 Fold spellings onto the store’s values first, as normalising attribute values describes, and add any genuinely new value to the attribute, under Stores > Attributes > Product, before the import.6
Symbols and units in number columns. £29.00 in price, 450g in weight. Each value is tested against its attribute’s data type, and Adobe’s sample file writes price and weight as bare numbers, 14 and 1.23.413 The unit is not in the file, so convert every weight to the store’s Weight Unit, lbs or kgs, before the unit comes off.9
Images the import cannot reach. A thumbnail, a dead link, or a file name with no file behind it. An image on the server has to be in var/import/images, or a subfolder of it, before the import; one elsewhere is written as a full URL.5 Each failure has its own message: “Imported resource (image) could not be downloaded from external resource due to timeout or access permissions.” and “Imported resource (image) does not exist in the local media storage.”4
Codes the spreadsheet has changed. Excel “automatically removes leading zeros”, and Microsoft names product codes among the values it does it to.14 Because Add/Update matches on SKU and creates any SKU it does not know, a supplier’s 004512 saved as 4512 comes in as a new product instead of updating yours.1 Adobe also warns that Excel “inserts additional characters into the column header of the CSV file”.3
Before and after: one simple product, one configurable
First, a pillowcase pair from the same file, a product with no sizes.
| Magento column | Supplier sent | Magento row |
|---|---|---|
| sku | FEN-LPC-GRY | FEN-LPC-GRY |
| attribute_set_code | not supplied | Default |
| product_type | not supplied | simple |
| categories | Bed Linen > Pillowcases | Default Category/Bedding/Pillowcases |
| product_websites | not supplied | base |
| name | PILLOWCASE PAIR LINEN GREY | Fenwald Linen Pillowcase Pair, Grey |
| price | £29.00 | 29.00 |
| weight | 450g | 0.45 |
| product_online | Live | 1 |
| visibility | not supplied | Catalog, Search |
| qty | In stock | no number given |
| additional_attributes | Colour: GREY / Fabric: 100% linen | color=Grey,material=Linen |
| base_image | FEN-LPC-GRY_thumb.jpg | full URL of the full-size original |
In stock is the one cell that needs a person: it is not a quantity, and no rule makes it one.
The duvet cover changes shape. The supplier sent one row, LDC-GRY, with Sizes: Double/King and £69/£79; Magento wants “a separate row for each simple product variation, and one row for the configurable product”.6
| sku | product_type | name | visibility | price | additional_attributes |
|---|---|---|---|---|---|
| LDC-GRY-D | simple | Fenwald Linen Duvet Cover, Grey, Double | Not Visible Individually | 69.00 | color=Grey,size=Double |
| LDC-GRY-K | simple | Fenwald Linen Duvet Cover, Grey, King | Not Visible Individually | 79.00 | color=Grey,size=King |
| LDC-GRY | configurable | Fenwald Linen Duvet Cover, Grey | Catalog, Search | 69.00 | none |
The configurable row also carries configurable_variations: sku=LDC-GRY-D,size=Double|sku=LDC-GRY-K,size=King. “Each SKU is separated by a pipe symbol (|), and attributes are separated by a comma”, each written as its code, size, “rather than the attribute label”.6 Not Visible Individually keeps a simple product out of listings, “although it might be available as a variation of another product”.2
Three things decide whether the rows join up. Two are in the attribute. The varying attribute “must have a global scope”, must require shoppers to choose a value, must be a Dropdown, Visual Swatch or Text Swatch, and must be in the product’s attribute set.7 Double and King must already be on its list.4
The third is names. Give each simple product one of its own: the default url_key is made from the name, “URL key for specified store already exists” is among Adobe’s messages, and Adobe’s example changes sku, name, url_key and additional_attributes on every new variation.246 Variants: size and colour covers what counts as a variation.
Preparing the file, step by step
- Export before you build. Export a few of your own products, a configurable one among them, and keep the header row: Adobe’s advice is to “first export the data from your store as a CSV file”.3
- Open the supplier’s file without letting Excel convert it. Load it through Data > From Text/CSV and set the code columns to Text, as Microsoft describes.14
- Map every heading to an attribute code, or to nothing, and create any missing attribute, with its options, first: the import cannot add one.38
- Give every row the basics that Adobe’s sample file gives its simple products: sku, attribute_set_code, product_type, product_websites, name, price, product_online and visibility.13
- Rewrite the values. Categories become whole paths from the root, values are folded onto each attribute’s list, compound cells such as Colour: GREY / Fabric: 100% linen are split, and weights are converted to the store’s Weight Unit before symbols and units come off.349
- Lay sizes out as simple rows and one configurable row, with configurable_variations naming every simple product.6
- Put images where the import can reach them. Server files go into var/import/images and arrive in a second file that “must include only the sku column and the related image columns”; images elsewhere go in as full URLs.5
- Save as UTF-8 and run Check Data on a few products first. Adobe supports UTF-8 and Windows-1252, and warns that a UTF-8 file with a byte order mark may not be recognised. After configurable products, refresh the invalid caches under Cache Management.416
What to do next
Part of that work is what RefynData’s product data enrichment service does with a supplier file: each SKU or barcode is matched to the real product, every item is filed into your own category tree, compound cells are split, spellings are folded onto one value, measures are converted to one unit and the full-size original is found behind each thumbnail, with every value linked to its source. We prepare supplier spreadsheets for Magento: the file comes back laid out for Magento’s own importer, and nothing goes live without your sign-off.
Export a product of each kind first and build on its header row. Run Check Data on a handful of products before the rest, and keep the map from the supplier’s headings to your attribute codes: the next delivery will bring the same headings and the same Sizes: Double/King.
Questions
What fields are required for a Magento 2 product import?
To update products, you only need sku plus the columns that change. A new product also needs every attribute the store requires: Adobe’s walkthrough for a simple product asks for a product type, an attribute set, a name, a SKU and a price, which in the file are product_type, attribute_set_code, name, sku and price.
Where can I get a sample CSV for a Magento product import?
On the Import page, set Entity Type to Products and click Download Sample File. A better template is an export of a few of your own products, configurable ones included, because it carries your store’s own attribute codes, attribute sets and category paths.
How do I import product images with a Magento 2 CSV?
Upload the files to var/import/images on the server and write each file name in base_image, small_image, thumbnail_image or additional_images, with commas between additional images. Adobe says that file must hold only sku and the image columns. Images on another server go in the same columns as full URLs.
How do I import configurable products in Magento 2?
Give each size or colour its own simple product row, set to Not Visible Individually, and add one configurable row whose configurable_variations cell lists each simple product’s sku and values, with a pipe between products. The attributes that vary must be global, required, a drop-down or swatch type and in the product’s attribute set.
Does a Magento import overwrite existing products?
Add/Update changes every field the file carries for a matching SKU except the SKU itself, and creates any new SKU or category. Replace deletes a matching product and creates it again from the row. Adobe’s pages disagree on whether an empty cell clears a value, so send only the columns you mean to change.
Sources
- Adobe Experience League. Import data.
- Adobe Experience League. Product data attributes reference.
- Adobe Experience League. CSV data files.
- Adobe Experience League. Data transfers.
- Adobe Experience League. Product image import.
- Adobe Experience League. Import configurable products.
- Adobe Experience League. Configurable product.
- Adobe Experience League. Create and delete product attributes.
- Adobe Experience League. General > General (Configuration Reference).
- Adobe Experience League. Simple product.
- Adobe Experience League. Adobe Commerce Admin User Guides.
- Adobe Developer. Import API.
- Magento Open Source on GitHub. catalog_product.csv, the sample product import file in Magento Open Source 2.4.9.
- Microsoft Support. Keeping leading zeros and large numbers.