Tip of the week #2: How to create Drupal nodes in batch from an XLS, CSV file or from an RSS feed?
I searched high and wide at the Drupal Modules on a solution that would allow me to create new nodes either from an RSS feed (so I could automatically create new pages based on my Google Alerts that I set for my topic of interest) or from a spreadsheet (where I kept track of a list of items of interests in the past.) In my search amongst the modules I used keywords like batch, create, xls but none of them yielded any useful results on the first few pages. Then a friend of mine was showing a project he was working on and I noticed that he was using a module I was not familiar with: Feeds. Reading its description I realized that I should have used “import” as keyword.
Feeds is great: in 5 minutes I created hundreds of nodes from my spreadsheet in my Drupal 7 site and it exists for Drupal 6 too. (I saw no news yet ow/whether/when there will be a Drupl 8 version). Feeds requires two modules: Chaos Tools, which I already had) and Job Scheduler. I was a bit hesitant installing the latter as its latest version is only an alpha, but seeing that almost 40,000 site has it gave back my confidence.
A side note: Before adding nodes in a batch you have to take care of two things:
- You have to have your content type ready for the importing, be it a page, post, book or a custom one. By “ready” I mean it should have all the fields with the proper formatting you want to import into.
- You have to have clean data in the document you are importing from. E.g. if it is a spreadsheet, make sure that all the content in all the cells is exactly what you want. Otherwise you will end up with less then ideal nodes in your Drupal.
After installation I had to create a “Feeds importer”. To do so I went in my admin menu to Stucture -> Feeds importers -> Add importer, aka at /admin/structure/feeds/create. I will not go through all the possible settings and configuration of the importer as for that you can find excellent sources online, e.g. this video and its slides or the official documentation. You probably want to play with it on a development site to learn all the nuances. They are not that complicated.
Recent Comments