I ended up using a drush script to import data into custom multi record fields:
create file import-script.scr
run it as: drush scr import-script.scr
script:
<?php
$file = '/var/www/html/sites/default/scripts/civicrm_value_import.csv';
$fh = fopen($file, 'r');
while ($row = fgetcsv($fh)) {
$contact_id = $row[8];
if (empty($contact_id)) {
continue;
}
// Build array for new data
$import = [
'entity_id' => $contact_id,
'discharge_reason_329' => $row[14],
'primary_presenting_problem_335' => $row[15],
'principal_diagnosis_336' => $row[16],
'diagnosis_2_337' => $row[17],
'diagnosis_3_338' => $row[18],
'opioid_dependency_339' => $row[19]
];
if (!empty($row[11])) {
$import += ['referral_date_331' => $row[11]];
}
if (!empty($row[12])) {
$import += ['enrolment_date_332' => $row[12]];
}
if (!empty($row[13])) {
$import += ['discharge_date_333' => $row[13]];
}
if (!empty($row[21])) {
$import += ['initiation_date_341' => $row[21]];
}
// print_r([$import]);
// Insert
db_insert('civicrm_value_raam_66')
->fields($import)
->execute();
// For testing one row
// break;
}