From CSV to Drupal 8 site (Part 1) - Broward Drupal Meeting Minutes - June 13, 2018

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
iribarne's picture

This month, I ( https://twitter.com/hectoriribarne https://www.iribarne.com/ ) presented "From CSV to Drupal 8 site - Part 1." Who needs lorem ipsum when you can build your Drupal 8 site from data in CSV files. This presentation covered how to export content and users from a Drupal 7 site to CSV files, and importing them into Drupal 8 without having to write custom code!

The presentation was divided into the following portions:

1) Exporting users from a Drupal 7 site and importing them into a Drupal 8 site:
- Using Sequel Pro to create a CSV file with the query in file D7_users_fn_ln.sql_.txt ( http://browarddrupal.org/PastMeetings/june-2018 )
- Use the migr8_users module ( http://browarddrupal.org/PastMeetings/june-2018 ) to create the migr8_users migration
- Use the drush mim migr8_users command to create the users on the Drupal 8 site

2) Generating CSV files for individual content types from D7 without writing any custom code:
- Get the Contentout sandbox module: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/iribarne/2461613.git contentout
- Find out more about the sandbox module here: https://www.drupal.org/sandbox/iribarne/2461613
- Once the module is installed on a local Drupal 7 dev site (i.e. do not install this module in production), go to /admin/config/content/contentout and generate CSV files with two clicks (one click to select the content type and another to generate the CSV file)

3) Importing content from CSV files into D8 without writing any custom code:
- The Drupal 8 code for the Contentin module is still in the works, but you can take a look at the D7 version at https://www.drupal.org/sandbox/iribarne/2461615
- Copy the CSV files (i.e. pages.csv, test.csv and articles.csv) under the public:// folder of your D8 site
- On a local D8 site, go to /admin/config/content/contentin
- Generate the migrations (i.e. contentin_page and contentin_test) for the Basic Page and Test (has to be created first) content types with one click
- Use the drush mim contentin_page and drush mim contentin_test commands to create content on the Drupal 8 site for the Basic Page and Test content types
- Demoed some experimental code to generate the contentin_article_files and contentin_article migrations from the articles.csv file and then used them to generate content for the article content type

Stay tuned for more in Part 2.

We had two remote users and four in person.

To keep up with the Broward Drupal meetup group, follow us on Twitter: https://twitter.com/browarddrupal or go to our website: http://BrowardDrupal.org

-- Hector

Florida

Group organizers

Group categories

Florida Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week