I have created a migration with the Migrate module that migrates data from a csv file into a custom entity. There are some rows in my csv file that don't have any data for the entity that I'm importing into, so I would like to skip the creation of those entities.

Is there a way I can do this?


in your prepareRow function test to see if a field is empty and if it is, return FALSE. For example:

public function prepareRow($row) {
  if ($row->data == '') {
    return FALSE;
  • 1
    Perfect. It worked. Thank you. I'm so grateful this was so easy. – mlanning Jan 13 '16 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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