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:

,Rhubarb,{filedir_1}bnb1.png,"Image 1","2011-01-01"
1,Rhubarb,{filedir_1}bnb2.png,"Image 2","2011-10-01"
2,Armadillo,{filedir_1}bnb3.png,"Image 3","2011-01-01"
3,Bananas,{filedir_1}bnb4.png,"Image 4","2011-01-02"
3,Bananas,{filedir_1}bnb5.png,"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

 Download our free add-ons