The node import module enables importing of nodes of any type into your site using comma separated values format (CSV). One possible use is with contact manager to import lists of contacts. Users want to be able to import content from other systems into their site.

Node import accepts a CSV file or a TSV (tab separated text file) as input. CSV files can be generated using spreadsheet programs. Your CSV file must contain field names in its first row. These field names can be anything; except when using raw data import type. Third party modules are able to potentially add additional import types, e.g. the now defunct contact_manager.

(In order to import list values one has to separate the values inside the contents of the CSV files by the pipe symbol (that is the '|' character). Very useful for importing multi-value Taxonomies too.)

Data can be imported into the following node types:

  • Page
  • Story
  • Event
  • Flexinode
  • CCK Node Types

You can

  • read about the function that reads CSV files called fgetcsv.
  • import nodes at Administer >> Content managment >> Import content.
  • administer node permissions at Administer >> User management >> Permissions >> node_import module.
  • file issues, read about known bugs, and download the latest version on the node_import project page.

For Drupal 7 it is advised to use the Feeds module for CSV imports.

Comments

tryitonce’s picture

I needed to import large files from csv to my site with special characters such as (äöuÄÖÜß, etc.).

When saving the original Excel file to csv I quickly found to use the simple CSV (Comma delimited) *.csv option.

But when uploading this file the cells containing these characters did not get imported.

Solution:

1. Excel -->> CSV (Comma delimited) *.csv
2. CSV (Comma delimited) *.csv -->> open in OpenProject or Editor such as NoteTabPro and save as UTF-8 format.
3. ready

You might need or want to change the *.csv extension in the process to *.txt and then back to *.csv. But it is not necessary - you can upload *csv and *.txt files and then specify the import type.

pierrot’s picture

This solution worked like a charm!

tryitonce’s picture

In response to a contact message:

The CSV file should contain in the first row the heading with the names of the CCK fields - the more accurate the heading is to the title - best identical - the easier it will be to do the node import:
Example
CCK fields are - Manufacturer - Model - Engine Size - ...
First row of the CSV fileManufacturer, Model, Engine Size, ...
Second row of the CSV fileFord, Mondeo, 2.8, ...

jainrutgers’s picture

Thanks very much for your response.

Can you please also mention how you tell node_import module
which content type to use.

Like in your above comment you clarified very well the mapping
between CCK filed and CSV columns.

But how in CSV file we can tell the node_import
to use a particular content type.

Also it would be great if you can attach a small csv file as an example.

Thanks

tryitonce’s picture

You need to follow the quite clear on-screen menus of node import - .....

I added this now as a child page - http://drupal.org/node/827750.

GalCo’s picture

Trying to figure out how to import very large .csv that has attributes. Atts are listed by record, not arrayed in field. 23000 records to import, so editiing out att records and then back in manually after import not an option. Pointers. I also have some ideas for you after I get this site built. 3rd site using inventory cvs imports...

tryitonce’s picture

I guess you might have to do this in full or part through the dbase - MySQL.

No idea how - but it might work to import the csv with the files that are covered and then add the oher list to MySQL.

Or - spend some time extending the node_import module to include attr.

Unfortunately - I can only offer some thoughts - but not actual help ....

shriji’s picture

Hi,

I created a content type Lecture and I added just on CCK filefield called 'mp3' to upload an mp3 file per node. I created one test node by just providing 'title' and 'mp3' which is selecting an mp3 file. Now I am trying node_import to import multiple files. To test this functionality, I created following txt file:

title mp3
ym sites/default/files/satsang/ym_0.mp3

where first row is col names and second row is actual data row.

It is failing with this error: Input error: 'sites/default/files/satsang/ym_0.mp3' is not allowed for mp3 (not a file in sites/default/files/satsang).

Am I doing something wrong?

Thanks

tryitonce’s picture

Lawyers will tell you to "read on". Always read to the end of the contract, the (legal) code, etc.

You need to look here - http://drupal.org/node/827750 and read line 2 and 3 of the step-to-step guide.

Then read http://drupal.org/node/827750#comment-3327522

francis55’s picture

I get:
Input error: techdoc/acme/version_7_2/Acme Installation Guide.pdf is not allowed for Download (not a file in sites/default/files).
My input file looks like this:

Documentation type	Product Name	Product version	Download	Title	Body
"Technical documentation"	"Acme"	"7.2"	"techdoc/acme/version_7_2/Acme Installation Guide.pdf"	"Acme Installation Guide"	"This manual explains how to implement Acme in your network."

My file is in sites/all/files/techdoc/acme/version_7_2/
I tried a number of variants:

  • adding in or removing double quotes (using Text delimiter=double quotes with Delimiter Separated Values checked
  • adding in por removing a slash at the beginning of the path
  • etc

By the way I followed the link provided (http://drupal.org/node/827750) and read the documentation in question, but could find information as to how to solve the problem.
Should I move all my files into the root directory (sites/default/files)? There will be rather a lot, and I want to distinguish between files of the same name in different versions, so that would not really be convenient.

francis55’s picture

I tried the simplest I could imagine:

Title	Download
"Acme Installation Guide"	"AcmeInstallationGuide.pdf"

With AcmeInstallationGuide.pdf in the folder sites/default/files
and still I get the same error Input error: AcmeInstallationGuide.pdf is not allowed for Download (not a file in sites/default/files)..
BTW I checked in Admin > File system > File system path, and it is sites/default/files

francis55’s picture

the input error above produces the following detailed printout

values = Array
(
    [created] => 
    [node_import_build_mode] => 1
    [title] => OmniVision Installation Guide
    [cck:field_doctype:value] => Array  ( )
    [cck:field_sub_type:value] => 
    [cck:field_attachment_file_name:data] => 
    [cck:field_product:value] => Array  (  )
    [cck:field_attachment_file_name:list] => Array
        (  [0] => 1  )
    [cck:field_version:value] => 
    [type] => documentationattachement
    [body] => 
    [format] => 1
    [cck:field_attachment_file_name:fid] => 
    [log] => Imported with node_import.
    [uid] => 1
    [revision] => 0
    [status] => 1
    [promote] => 1
    [sticky] => 0
    [comment] => 2
    [path] => 
    [name] => admin
    [taxonomy] => Array (   )
    [field_doctype] => Array    (   )
    [field_sub_type] => Array   (   )
    [field_attachment_file_name] => Array   (     [0] => Array        (
                    [fid] => 
                    [list] => 1
                    [data] => 
                )
        )
    [field_product] => Array ( )
    [field_version] => Array  (  )
    [op] => Preview
)
francis55’s picture

I opened the import file with Notepad++, saved it in UTF-8 encoding (not UTF-8 without BOM)), using:

  • Record separator : Newline
  • field separators : Tab
  • text separators: none

Why it didn't work before and why it works now just beats me.

burt.lo’s picture

If I understand the mechanism properly, there's a default directory for file to be placed in order to be imported. From your example, I surmise that to be "sites/default/files/satsang/". If that is true, then your files will be located in that folder before you begin the import process.

Thus, in your txt file, I would suggest removing the path information in your 2nd column and simply include the name of the file itself. The path will be derived from the import settings location.

HTH!

shriji’s picture

FitPM, I love you!!!!

I am new to drupal and knows nothing about PHP. You idea worked like a charm!!! I have been struggling for days to find out a solution to import 20 K mp3 files to my installation. I have a hope now...thank a bunch!!!

adr75’s picture

Hi, Thank you for this great module. Works great for me when importing custom content types with cck fields and custom delimiters etc. Would it be an idea to have the module remember a previous import (already does I think) and allow you to skip the import steps? That would be very useful if you import the same content formats all the time. Cheers.

bonk’s picture

Hi
i like the module, because it helps me to import datas from another system. But it seems so, that there is no posibillity to import date/timestamps, even this module depends on the Date-API module. Is there a way to get timestamps-import running?

bmango’s picture

subscribe

tryitonce’s picture

the project page indicates ways to help the maintainer to keep the project going and you can always write or sponsor the writing of additonal filters / scripts for the module data you need ....

bmango’s picture

I have tested a patch before, and I have checked the project page for this module and will be happy to test and report back, but I don't think there is a current patch that needs testing.

wer0ckz’s picture

hi.

I am using "node import" module. http://drupal.org/project/node_import

i was able to import my old cms(NOT DRUPAL - unknown cms) 'article' database table to drupal content type 'articlces' -
but it has no taxonomy linked to each article(the imported ones) and my drupal has taxonomy vocabulary term of "news and results"

My goal here is that an article in the current site is tagged with News, it'll have the news tag in drupal

when i import the article tables form old cms to drupal using node import, i can see a part where i can map a column for tags, but the table columns for old cms articles doesnt have a column about tags - here is the screenshot of table articles from old cms http://vorlage.net.au/trash-images/5.jpg

I was wondering what table in drupal can i find similiar to this http://vorlage.net.au/trash-images/tags.jpg (my old cms tags table)
and how can i link the tags?

thanks

tryitonce’s picture

.... you should find an answer quicker by searching drupal.org or by googling for the question (just include "Drupal" as a search word).

And if there is nothing else around ask a question in the post installation forum. When you find a solution just come back here to tell us or to leave a link - thanks

wer0ckz’s picture

lol i tried everything. click my name and click track you'll see

bogumilas’s picture

What about Organic Groups, are they supported by this module already?
I have found this message on the project page:

"Estimated time for node_import-6.x-1.0-rc5 is Friday April 9th 2010. It will include new supported modules (Organic Groups, more CCK fields)..."

Well, it's October and the module is still at 6.x-1.0-rc4...
Any suggestions for another module which supports importing og?

Thanks in advance,
Bogumila

pjindent’s picture

While attempting to import CSV file containing products using node_import I get:
Fatal error: Call to undefined function uc_product_node_is_product() in /home/pjindent/public_html/sites/all/modules/node_import/supported/ubercart/uc_product.inc on line 15

Any help would be appreciated. I am using Ubercart version = "6.x-2.4"

tryitonce’s picture

Have a look here - http://drupal.org/node/827750

You might find that the module you want to use in your importing is not supported.

See the details about that in the link quoted above.