Drupal Imports using Feeds Module

Sometimes it can be a huge time saver to import large sets of data into Drupal, rather than entering content one-by-one through the admin interface.

Example:

Say that your client has a spreadsheet of a couple hundred people that includes a first name, last name, weight, height, gender, etc. It would take way too long to enter those one at a time.

There are actually quite a few ways to import content into Drupal, and we've written about the Migrate module before. Since I'm not a full-time developer, I typically seek out less technical solutions.

Node Import, and Feeds are two solutions I've used recently to import content. From my experience Feeds has been a bit more flexible, so I'll focus this tutorial on that module.

I'll highlight the steps it takes to import content with Feeds, and if you are more visual learner, you can check out the screencast at the end of this post.

Setting up Feeds on a Drupal 6 Site

  1. Download Feeds and the dependent modules (CTools & Job Scheduler at the time of writing this post)
  2. Enable Feeds, Feeds Admin UI, Feeds Import and the dependent modules
  3. Create a CSV File - Organize and format the content you would like to import and save it as a CSV file. (Note: Feeds can also import RSS/Atom/RDF based content...hence it's name, but I'm going to focus on it's ability to import CSV files)
    • The first row should contain column headers that accurately describe the content
    • Each subsquent row in the spreadsheet will equal one imported node in Drupal
  4. Navigate to Feeds in the Drupal admin http://yoursite.com/admin/build/feeds/create
  5. Create a "New Importer" and provide a name & description
  6. Basic Settings
    • Name & Description - Update if needed
    • Attach to Content Type - Leave as default, "Use standalone form"
    • Minimum Refresh Period - None
    • Import on Submission - Leave Checked
  7. Fetcher - Choose File Upload
  8. Parser - Select CSV parser
    • Under parser settings, leave the comma as the default field delimiter
  9. Processor - leave the default as Node processor
    • Settings - Set content type you are importing content for
    • Mapping - Match your CSV column headers to fields in your content type. Each column header that you wish to import should be added to this page.

Your First Import

  1. Have your CSV file ready (see step 3 above)
  2. Navigate to http://yoursite.com/import and choose the import you just setup
  3. Click Import

If all went well, your new content should now exist as nodes in Drupal. Navigate to the edit screen http://yoursite.com/admin/content/node and check out some of your newly imported content.

See the Screencasts

Drupal - Import CSV Data Using Feeds - Part 1

Drupal - Import CSV Data Using Feeds - Part 2

20 Comments

Does Feeds work well with the Location module? I have a case where I need to import both node location information and CCK based location info on the same node. The Node Import module can handle the node location part but not the CCK Location fields.

Eric

@Eric A. You are in luck! I imported locations recently using the same process described here, with the addition of Location Feeds module.

Excellent!. That module gets bookmarked immediately.

Thanks, Eric

The 'Feeds Import' module is not required for this example. It is simply an example of how to use a 'default' configuration using Features. It is an unfortunate name though.

Can we add images also to the node by specifying the file path?

@Chris Thanks for the tip.

@Anonymous You can add images / files. 1. Make sure your images exist online somewhere 2. In your CSV file, make sure you include the full path to the image(s).

Feeds will import the images and put them in the correct location in your files directory.

Hi I am trying to import a CSV file which is continuously being updated but the feeds module is not pulling in new data. Can someone guide me exactly how I should have the module set up and all the modules i need for this to work.

If I'm not mistaken this method won't work for importing multi-value fields or mulit-value taxonomy terms.

I've set up Feeds under Drupal 7 exactly as described above making sure that my csv file of mailing list data has a unique primary key. Feeds uploads my mailing list properly creating database tables for each field in the spreadsheet (e.g, name, address, city, etc). Feeds, however, fails to append new id records to Drupal's nodes table, making it impossible to retrieve any information with the Views UI in out-of-the-box form.

@Peter Gosling - I haven't done this before, but there is a setting for this in Feeds. Under Settings for Node processor find the Update Existing Nodes settings section and update that to "Update existing nodes (slower than replacing them). Please test first.

@dalin - I'm not sure. Migrate may be a better option if you need to import more complex data.

@Bill Wilken - I haven't used Feeds for D7 yet. You may want to post something in the Feeds issue queue.

Thanks for the breif tute and the screencasts; they came in useful since i have been migrating a D6 to D7 development. Previously I had been using Node Import to import .csvs and am disappointed there isn't a D7 version. But after some trial and error I have got feeds to work in D7. Its worth noting that if you get errors you should check out the patch in post 1 here http://drupal.org/node/973876

Hi,

like your admin theme, is it an open theme ?

I tried to feeds from local file (big file 20mo), without success, i dont' understand the file root ( try sites/default/feeds/myfile.csv), i don't understand must start with "//public" ?

Thanks, Florent

Hi, Thanks for this tutorial. Everything works good. Now i would like to import, for exemple, 10 rss feeds at the same time with a CSV file (with taxonomy fields). But ... after some try, i'm not sure it's possible. Do you have idea how i could do that ?

THANK YOU , THANK YOU , THANK YOU ! Cutting and pasting census transcriptions into WYSWYG individually has been a headache . I will try this now .

I've been messing around with this lately and while I have it working, I'm stuck on something:

The CSV I have has rows of products. Each product has a product_id. I've managed to run the CSV import and it publishes the data from the csv as feed items (using a product_content_type Ive made). That part works fine.

I want to take that product_id on import and have it place that in a form. Meaning I want each imported feed items to contain a form that uses the product_id to make a request to the shopping cart.

Anyone able to point me in the right direction to do this? I just want to generate a form for each item that's brought up from the feed imported csv.

@huwami, thanks for posting. Are you trying to import these as Ubercart Products or something else? I believe there are options to import Ubercart products via Feeds.

Is it possible to get imported items to add themselves to a menu? I can't seem to figure it out.

Thanks for these videos, great help.

Have tried to use feeds to import data from a csv file. Have followed the instructions in your video but, although I get the "importing" progress bar and 3 records appear to be imported (there are only 3 in my "test" csv file), there is no data in them. My content-type has 3 list(integer) fields. Could this be the reason?

How to upload a XML file using feeds module.. A table should be created when once we upload XML file

It's been almost 11 monthes since the drupal 7 version is in alpha.

Add a comment

About the Author

Joel Steidl

Senior Designer

Joel excels at making complicated design problems simple through good interface design. Whether designing or coding, Joel has a passion for doing things right.

Read More Joel's Blog Posts
DrupalCon Denver 2012 - Gold Sponsor