Rule: Data File Import (CSV / XML)#
Using the Data File Import rule, you can import data from an external XML or CSV file into existing items in your project. The file can be uploaded directly to the rule or you can provide a URL address from which data is regularly loaded. This way, you can enrich product data with, for example, availability, performance statistics, margins, or other supplementary information.
Extra features#
- Matching mode:
- Key matches exactly – the matching element values are identical in both the source and Mergado.
- The value from the imported file is loaded only when the import value equals the matching element value in the project.
- Typically used for matching by unique product ID.
- Key is contained – the matching element values partially match.
- The value from the imported file is loaded only when the matching value from the import is contained within the matching element value in the project.
- Typically used for matching by keyword in the name or categories of a product.
- Key matches exactly – the matching element values are identical in both the source and Mergado.
- Supported file types:
- XML
- CSV
- Google Sheets (by publishing the Sheet as CSV at a public URL address)
- File connection method:
- Upload file – one-time import.
- If the data in the file changes, you need to manually re-upload the file.
- Enter URL – dynamic connection.
- If the data in the file changes, new values are loaded automatically with each project regeneration.
- Upload file – one-time import.
- Field delimiter:
- Comma, semicolon, pipe – depending on the format in the source file (comma is the default)
Practical examples#
Example 1: Import stock availability from a Heureka availability XML feed#
This example shows how to use the Data File Import (CSV / XML) rule to enrich a standard product feed with product availability information from an external XML feed (e.g., Heureka).
1. Preparing the project before import – before the actual import, you need to prepare the project so the import works correctly
- Element names you want to import (or column names in the CSV file) must match the element names in the project where you will write the data.
- If you want to import an element that does not exist in the project yet, you need to create it manually:
- Open the Elements page.
- Click the New element button.
- Enter the element name and confirm the creation.
- Elements you will import into can be hidden – their visibility does not affect the import.
2. Creating a new rule:
- Open the “Rules” page.
- Click the New rule button.
3. Selecting the rule type:
- In the Rule type field, select the Data File Import (CSV / XML) option.
4. Selecting products:
- In the Query field, choose either All products or create your own Product query for specific products you want the rule to apply to.
5. Data file source:
- Using the toggle (Radio button), select where the file should be loaded from:
- Enter URL
- In the URL address field, paste the address to the XML or CSV file (e.g., the Heureka availability feed URL).
- Click the “Import” button.
- Mergado automatically detects whether it is a CSV or XML and adjusts the rule interface accordingly.
- Upload file from computer
- In the Data file field, click the “Upload file” button and select the file from your computer (e.g., Heureka availability feed).
- Mergado again automatically recognizes the format and adjusts the settings.
- 💡 Tip: The maximum upload file size is 25 MB.
- Enter URL
6. Element bounding the item (only for XML import):
- In the Element bounding the item field, set the element that bounds the item in the XML file (typically this is SHOPITEM or ITEM), including the parent root element.
- In our case, we will use:
item_list | item
- In our case, we will use:
7. Matching element in the current project:
- Select the element from the current project in Mergado that you want to use for matching products with data from the imported file, for example, the product ID:
g:id- 💡 Tip: If possible, select the matching element from the project’s input feed. This allows faster evaluation and processing of the rule during project regeneration.
8. Matching element in the imported file:
- Select the element from the imported file that contains values corresponding to the selected matching element in the current project, e.g., the product ID attribute in the Heureka availability feed:
@id
9. Match by input values:
- The “Match by input values” checkbox is enabled by default.
- When active, data is matched by the original values from the project’s input feed (before any Mergado modifications).
- If you disable it, matching will use values that may have already been modified by other rules.
- ⚠️ Warning: Disabling this option can slow down data processing.
10. Advanced settings:
- In the Advanced settings section, configure:
- Matching mode using the Selectbox
- In our case, we will use the Key matches exactly mode.
- Whether to distinguish between uppercase and lowercase using the Checkbox
- In our case, we will leave the checkbox unchecked.
- Matching mode using the Selectbox
11. Naming the rule:
- In the last step, enter the rule name, for example Import availability.
Additional uses#
- One-time import of EAN codes or other values (for example: GPSR data or missing image URLs)
- Connect dynamic values from Google Sheets to Mergado
- Performance data from Google Analytics (clicks, impressions, orders)
- Product seasonality
- Stock levels
- Import custom_label for PPC
- Import data for segmentation and setting custom_label for PPC
- Import purchase prices and margins for automatic pricing using the Pricing Fox extension
- Import translations (if you have translations in another language in a different feed and need to bring them into Mergado)
FAQ#
What is the Data File Import rule for?#
The rule is used to import external data from XML or CSV files into existing products in your Mergado project. This allows you to enrich the feed with information the original source does not contain – e.g., stock availability, margins, purchase prices, performance statistics, or dynamic labels for PPC campaigns.
What file formats does Mergado support?#
- XML (e.g., Heureka availability feed)
- CSV (e.g., spreadsheet export from an internal system or ERP)
- Google Sheets, if published as CSV at a public URL address
💡 The maximum upload file size is 25 MB.
What is the difference between uploading a file and entering a URL address?#
- Uploading a file – one-time import. If the data in the file changes, you need to manually re-upload it.
- Entering a URL address – dynamic connection. With each project regeneration, the current values from the external file are automatically loaded.
💡 Recommended for data sources that are regularly updated (e.g., availability, prices, performance).
What does “Element bounding the item” mean for XML imports?#
This setting determines which XML node represents an individual product. E.g., in a Heureka feed it is SHOPITEM, in other XML feeds it can be ITEM or PRODUCT. In Mergado, it is written with the root element, e.g.: item_list | item.
How does product matching between the imported file and the project work?#
Using matching elements:
- In the current project, you select the element to match products by (e.g.,
g:id). - In the imported file, you select the corresponding element or attribute (e.g.,
@id).
💡 Ideally, the values of these elements should be unique and identical between the project and the file.
What is the difference between “Key matches exactly” and “Key is contained”?#
- Key matches exactly – the matching element values must be exactly the same (
123 = 123). Used, for example, when matching by product IDs. - Key is contained – matching occurs if the matching element value from the import is found within the matching element value in the project (e.g.,
123is contained inSKU_12345). Suitable for matching by part of text (e.g., name or category).
What is the “Match by input values” option for?#
This option determines whether Mergado will use for matching:
- input values from the source feed (default setting), or
- values after rule application (if you disable the option).
💡 It is recommended to keep it enabled – matching is more stable and faster. Disabling it can slow down project generation. Be careful, though, whether the selected matching element from the project has input values. If it does not, you need to disable this option, otherwise matching will not work.
What does the “Case sensitive” option in advanced settings mean?#
When enabled, matching considers the difference between lowercase and uppercase letters. E.g., ABC does not equal Abc. If left unchecked (recommended), Mergado ignores the difference in letter case.
What happens if an element from the imported file does not exist in the project?#
The import will not work until you manually create the element in the project (with the same name). On the “Elements” page, click “New element”, enter the name (e.g., availability), and confirm. The element can also be hidden – visibility does not affect the import.
Can I import multiple values at once (e.g., availability, price, and EAN)?#
Yes. The “Data File Import” rule allows importing multiple columns (CSV) or elements (XML) simultaneously, as long as they are correctly mapped.
How can I use the import for data from Google Sheets?#
- In Google Sheets, click File → Share → Publish to the web.
- Select the CSV format and copy the generated URL.
- Paste this URL into the “URL address” field in the Data File Import rule.
- With each regeneration, Mergado will load the current data from the Sheet.
💡 This way, you can connect, for example, dynamic labels, performance data, or daily prices.
How do I check that the data was imported correctly?#
After saving and applying the rules or after regenerating the feed, you can:
- open the Products page, find a specific product, and verify that the new data appeared in the relevant elements,
- or use the Rule walkthrough feature, which shows how the data was matched and loaded.
💡 If values were not imported, check the element names and matching keys.
Can the rule be used for a one-time data import?#
Yes. For one-time additions (e.g., EAN codes or GPSR data), you just need to upload the file manually. However, the rule must remain in the project; otherwise, the uploaded data will be deleted again.
Can the rule be used to import performance data from Google Analytics or other tools?#
Yes, if you have the data available in CSV (or XML) format. An alternative solution is to use the Bidding Fox Elements extension, which loads this data into Mergado automatically. For example, you can import click counts, impressions, or orders by product ID. This way, you enrich the feed with performance metrics that can then be used to optimize bidding strategies.
What should I do if the import does not work correctly?#
Check:
- that the file is accessible (the URL is public, does not require login),
- that it has the correct UTF-8 encoding,
- that the element/column names match the names in the project,
- and that the matching is correctly configured.
💡 For testing, you can upload a file with fewer items and verify that it maps correctly.
Can the import be used for automatic pricing (e.g., margins, purchase prices)?#
Yes. Using the import, you can add, for example, purchase prices or margins to the feed, which you can then use in Calculation or Round Number rules for dynamic pricing. In combination with the Pricing Fox extension, you can even fully automate price adjustments.