0

I would like to import a CSV file into but the entries contain Matrix fields. When I set up the file, FeedMe provides a way to map columns in the CSV file to specific Matrix fields but I can't find a way to format the CSV file in a way that will allow FeeMe to generate multiple Matrix entries.

Example:
The CraftCMS entry has a Matrix field called References and this field has one block with two fields: Reference Title and Reference URL.

The CSV file has two columns Reference Title and Reference URL which I have mapped accordingly using FeedMe. For some entries I have multiple references so I need FeedMe to create one Matrix entry for each reference.

I have tried using the delimiter -|- between the title like so:

Reference Title                 Reference URL    
Example Ref1 -|- Example Ref 2; https://example1.com -|- https://example2.com

but FeedMe generates only one entry that contains both titles and URLs:

  • Reference Title ends up as: ["Example Ref1","Example Ref 2"]
  • Reference URL ends up as ["https://example1.com" -|- "https://example2.com"]

Is there a way to format the CSV in way that will make FeedMe generate two separate Matrix entries?

1
  • I don't know if there's an easy solution via CSV formatting, but I've had great success in the past by converting the CSV data to JSON, and then manually formatting the converted data for the Matrix fields where you need multiple entries as arrays. FeedMe seems much happier working with JSON data in general, and it's a lot easier to describe multiple entries for a single field in JSON than it is in a CSV. Commented Jan 26, 2023 at 9:31

1 Answer 1

-1

You may want to ignore my comment above - I discovered that there's an option to set a dataDelimiter character (docs) which should help with your CSV import, as described in this SE answer.

3
  • Thank you for looking into this! However, as I described in the question, I did use a data delimiter "-|-" and it did not work. The system did not create multiple matrix entries. The delimiter does work for categories, checkboxes, etc. But I can't get it to work for Matrix fields. Commented Jan 26, 2023 at 11:55
  • Ah, my apologies. I wasn't 100% sure that you'd set the dataDelimiter option already from your question. In that case, I would definitely try converting your data to JSON if that's an option. Commented Jan 26, 2023 at 12:55
  • Unfortunately CSV is the only option at this point for this dataset. Commented Jan 27, 2023 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.