Need help? I've been developing websites for over 20 years and specialise in ExpressionEngine development and support Get in touch

Importing data into a Grid or Matrix field from a CSV file

» Visit the DataGrab support page

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

Data format

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:

1,Rhubarb,,"Image 1","2011-01-01"
1,Rhubarb,,"Image 2","2011-10-01"
2,Armadillo,,"Image 3","2011-01-01"
3,Bananas,,"Image 4","2011-01-02"
3,Bananas,,"Image 5","2011-01-03"

Here, each entry has some common data (ID, TITLE, DATE) and some data that changes for each row of the Grid/Matrix (IMAGE, LABEL).

DataGrab configuration

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.

DataGrab configuration

DataGrab configuration 2

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).

DataGrab configuration 2