CSV import to ease your work with MERGADO

Anna Grzelczak
6. 9. 2019
5 minutes read

In the first part of our current release, we introduced improvements and fixes that will simplify your work with MERGADO. One of the new features is a new type of Data File Import rule, which we will show in detail today.

In the first part of our current release, we introduced improvements and fixes that will simplify your work with MERGADO. One of the new features is a new type of Data File Import rule, which we will show in detail today.

Hot tweak

In a nutshell:

  1. You can use the rule to upload data from an external source into the project (for example, import stock availability or parameters into the product feed).
  2. The rule can import CSV data with different separators.
  3. You can import data from an uploaded file, or a URL — even from a Google spreadsheet.

Our team has been busy this summer, bringing you a new type of rule — Data File Import. This allows you to use a CSV file to import modifications to existing items. In order for the CSV file to be uploaded, it must meet the following conditions:

CSV requirements to enable data feed amendment:

  • to be coded in UTF‑8,
  • the file can contain an unlimited number of rows or columns, but the maximum size of the uploaded file is 25 MB,
  • The field separator can be: 
    • comma, semicolon or vertical bar:
, ; |
  •  if the element value contains a separator, the value must be enclosed in quotes:
""

Structure of the column in the file

The first column is the so-called pairing column. The initial row of the first column (equivalent to cell A1 in Excel or Libre / OpenOffice Calc) defines a matching element that already exists in MERGADO (the most commonly used is the product ID). This is either any existing element in the current export or a special field: xid, representing the internal ID of the item in MERGADO (see below). The other rows are the values of the matching element in MERGADO (the value of the ID of a specific product, for example 123abc). If the product with the given ID is not present or hidden in MERGADO, the values will not be imported into the element.

The other columns define the exact names of existing elements in MERGADO, whose values will be filled according to what the rows of the CSV file contain. If any of the columns contain an element that does not exist in MERGADO, the editor ignores that column and does not automatically create the non-existing elements. Therefore, keep in mind that you need to have the elements in MERGAD pre-created in exactly the same format as they are in the CSV file. The element names must match exactly, whether they are case-sensitive, space or hyphenated.

Pairing modes

1. exact match

Changes are made to products, that first row in CSV file exactly matches the value of the matching item (that is, the item that specifies the data file in cell A1). We recommend using this mode as default and you can set it in the rule settings in the UI. You can also set whether or not case matters when matching. If a file defines multiple lines with the same matching value, in exact match mode the lowest line always applies (lines further down in the file overwrite the lines before).

2. Partial match

Applicable if the value of the matching element (specified in cell A1 of the CSV file) only partially contains the value matching the first column.

Please be aware that you can set whether pairing is case-sensitive or not. This mode can be configured in rule settings.

Also note, that the top row has causative power for partial mode. If a product is paired with a specific row in the data file, all additional rows are skipped.

3. Special matching mode according to MERGADO internal product identifier

This mode cannot be enabled in the Rules menu, but it is automatically enabled when the data file defines a pairing field with the value: xid. User settings in this pairing mode are ignored and pairing is enabled accordingly to the internal ID /: xid element in MERGADO.

When you export items to a CSV file on the Products page, you will get it in this exact format — the first column of the CSV defines the xid field for each product. If you then open this file in Excel or Libre / OpenOffice Calc), you can easily define a large number of manual changes for each product. If you then upload this modified file to a Data File Import rule, your changes will be represented by a specific bulk rule that can be paused, moved or outright deleted.

Adding parameter values

If we enter only one parameter value (in MERGADO it must be created beforehand and entered in exactly the same form), for example: color, the element-path can look like this:

ITEM_ID ; PARAM { PARAM_NAME = "Color" } | VAL
123456; Red

If you use multi-value element, for example to add two different material types, the procedure would look like this:

ITEM_ID ; PARAM { PARAM_NAME = "Material"} | VAL ; PARAM { PARAM_NAME = "Material" AND @@POSITION = 2 } | VAL
1234563; Cotton 60% ; Polyester 40%

REMEMBER: When managing the feed in MERGADO 2, the path to the element is different. Therefore the parameters are no longer used for MERGADO 1: PARAM|Material|1 , PARAM|Material2.

Import Rule FAQ

What to do, if: 

  1. Import rule causes an error when applying rules -> This is usually caused by a bad column name in the imported CSV file. 
    1. Open the CSV file and check/​correct the column names.
    2. They must be identical to the Element names in MERGAD (if there is a path to the element in the column name, it must be correctly written = valid).
  2. Import rule does not import data -> Apparently, no products were found for which data should be imported. 
    1. Open the CSV file and check the values in the first (matching) column, which is used to find the products.
    2. Try to create a selection by enumeration using these values and you will immediately see if any products are found.
    3. If they are found, turn on product tracking for some of them when you pass the rules and apply the rules only to the tracked products.
    4. You can then see from the change log what is happening to the product when the rules are applied and discover the cause of the problem.
  3. Import rule overwrites data to more products than it should -> Check “Pairing mode” in the rule edit. 
    1. You will probably find there that “The key is contained in the value”.
    2. In that case change the setting to option: “The key is exactly matched”, which we recommend to use primarily.
  4. Import rule still not doing what you need -> Contact our technical support.
    1. We will take a look at the rule settings and quickly figure out what the problem is.

The updates are constantly moving MERGADO forward and we hope that the second batch of innovations has made your work easier and more efficient. Let us know what you think and keep an eye on our forum, where you can always find out the latest information about improvements or fixes in MERGADO.

Mergado with a 30-day free trial
  • optimize your feed by yourself and save the cost for the developer’s time
  • full access to all features already in the trial version

Read more:

Anna Grzelczak

See other articles by an external specialist Anna Grzelczak