Import data to custom fields

Is there an easy way to upload a CSV file with items to insert into a custom field?

Hi Andy,

Yep, Data Admin can import CSV data into custom fields, and it handles merging them into any existing serialized data. Here’s a previous post with the info for how to set it up. Easy is relative, but in theory you just need to create the YML file with the names of the fields as a Custom Import:

Hope this helps!

Thanks Sandra. Will give it a go.

I gave it a go. Got to the dry run successfully but when I submitted I got error messages:

Warning: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE gibbonPersonID=‘0000001413’’ at line 1 in /home/rapid1/public_html/purongo/anfield/src/Gibbon/sqlConnection.php on line 171

The first few lines of the csv file are:

Person remark Custom Fields
20130101 "words words words"
20130114 "words words words"

Any thoughts as to what I need to do? I’ve tried replacing apostrophes with ` but same result.
My custom field is ‘remark’. What should go in the ‘custom fields’ column’?

Hi Andy,

Hmm, odd. Is the whole CSV file quoted with “”, or just the one remarks field? The extra ""s might be throwing off the importer. When assigning the columns in step 2 (right before the Dry Run) did the column of preview data appear correct?

The Custom Fields column can be set to [Custom Value] and then left blank. The actual value & serialization is handled by the importer (but it does need to be there, for reasons I don’t currently recall).

If need be, there’s some debug output on lines 560-562 of /modules/Data Admin/src/Importer.php you could enable to see where the malformed part of the SQL is.

Also, I’ve edited your post to remove what might have been personal details.

The remark field is quoted but nothing else.
I have removed all quotation marks from the text to be sure.
Preview and dry run look fine.
I’ll take a look at the debug.

How is this supposed to work in v20? I am confused.
What are the Example 1, Example 2, Example 3, Custom Fields fields?
I created a single custom short text field called Middle Name.
I put username in Person column. Where/which column do I put the Middle Name to update user profile. I put it in Example 2 column and changed column name to Middle Name? No error but field empty for users after import.

Took me 2 hours but I figured it out :cry:
resources → imports → usersCustomData.yml