Migrating data from CSV file(s)
From time to time, you will encounter the need to migrate data into Drupal, which comes in various formats. One such popular format is CSV, or a comma-separated value. CSV files can be exported from various database clients and spreadsheet software and make an excellent data source candidate for migrations.
Getting ready
From here, we are going to need to add two modules to migrate from CSV files. Using Composer, download the following modules:
- Migrate Plus (https://www.drupal.org/project/migrate_plus)
- Migrate Tools (https://www.drupal.org/project/migrate_tools)
- Migrate Source CSV (https://www.drupal.org/project/migrate_source_csv)
You will also need to create a custom module where we will place our migration definitions, source plugins, and process plugin classes. At this point, you should be familiar with creating a custom module. Consult the previous chapters if you need to refresh.
How to do it…
When you...