Importing into Grid or Matrix field
Importing data into a field that allows repeating data is a bit trickier using a CSV file but can be done if the data is formmated correctly
Last updated
Importing data into a field that allows repeating data is a bit trickier using a CSV file but can be done if the data is formmated correctly
Last updated
To import multiple rows of Grid (or Matrix) data, you need to have multiple rows of data in the CSV file. These rows should be identical and contain all the data for the entry you want to import, and also have a way of identifying that the rows all belong to the same entry. The Title field may work here but a unique id (such as a product or stock id is better).
A simple example is:
Here, each entry has some common data (ID, TITLE, DATE) and some data that changes for each row of the Grid/Matrix (IMAGE, LABEL).
You can then set up the Grid/Matrix as normal. You probably want to delete any existing rows if you are doing an update. For a one-time import, you can ignore the Action to take when an entry is updated option.
We are also importing the unique ID field to the GUID custom field.
To let DataGrab know which CSV rows are related to which entry you need to set up the “Use this field to check for duplicates” option to a field (custom or Title). If DataGrab finds an entry that has a matching value in this field (in our case the GUID custom field) it will update and append the new Grid rows to the existing entry.
You also need to check the “Update existing entries” to get it to update (rather than overwrite or ignore).