Skip to main content

How to Import Hierarchical Taxonomies in Drupal 7

Published on 2012-10-03

Taxonomy CSV Import Export (taxonomy_csv) for Drupal 7 is a great module to save a lot of time when creating your new website. It lets you import vocabularies. But the setup is obscure sometimes.

On a thread I provided this guide howto Import Hierarchical Taxonomies with taxonomy_csv.

Hope it can help you!

Import Hierarchical Taxonomies with taxonomy_csv

Going to summarize howto import a hierarchical taxonomy with its fields. It's a bit obscure and you need configuration on import. I cannot solve importing a hierarchy and descriptions in one step. But I can import a hierarchy or terms with fields. So you can do it in 2 steps! Follow me.

First I created a vocabulary 'hierarchy' with 3 terms and descriptions:
- Fauna: Animal life
- Flora: Plant life
-- Flower: Bloom or blossom plant

Step 1: export and import the hierarchy

Export hierarchy

Goto '/admin/structure/taxonomy/csv_export'
Choose 'Hierarchical tree structure', Export


The hierarchy is exported by using this notation: " 'root-term', 'child-term', etc... ". So no parent-tid, but term-path.

Import hierarchy

Goto '/admin/structure/taxonomy/csv_import'

  • tab 1: Type of import: Structure, Type of structure: Simple tree
  • tab 2: copy-paste exported result
  • tab 3: delimiter=«,» enclosure=«"»


This should create the vocabulary 'Auto created vocabulary'.

Step 2: export and import descriptions and other fields

Export fields

Goto '/admin/structure/taxonomy/csv_export'
Choose 'Fields', Export

"Fauna","hierarchy","Animal life","plain_text","1",""
"Flora","hierarchy","Plant life","plain_text","2",""
"Flower","hierarchy","Bloom or blossom plant","plain_text","0",""

Import fields

Goto '/admin/structure/taxonomy/csv_import'
For 'Fields' use this configuration:

  • tab 1: Type of import: "Fields", Set order of items on a csv line*: "name, original_vocabulary, description"
  • tab 2: copy-paste exported result
  • tab 3: delimiter=«,» enclosure=«"»
  • tab 4: choose vocabulary we just created: 'Auto created vocabulary'.

* use the machinename of the field, see admin/structure/taxonomy//fields

There is one problem. For each term our import created the field 'original_vocabulary' with value 'hierarchy' for us. We can solve this 2 ways: first way is manualy delete the column "hierarchy" from the export file before importing. Then as import structure you choose "name, description". Second way is after import go to "/admin/structure/taxonomy//fields" and delete the created field.

With this import-type I succesfully imported terms-relations and a lot of other fields.


We now succesfully imported a taxonomy with its hierarchy and 2 fields: 'term-name', 'description'.