Import a taxonomy using Excel
Using taxonomies, you can classify subsets of metadata. A taxonomy can have many hierarchical values (for example, in a tree structure), and it controls security. You can import taxonomy hierarchical levels into an existing taxonomy using the Excel import functionality.
The following example illustrates how to create a basic empty taxonomy named BasicTaxonomy that you can then use for the import.
Create an empty taxonomy for the import
To create an empty taxonomy for the import:
On the menu bar, click Manage .
On the Manage page, click Taxonomy and then click New taxonomy.
In the New taxonomy dialog box, in the Name and Label fields, specify a name and label (for example, BasicTaxonomy) and click Create.
On the Taxonomy Management page, click Show definition to see the initial default definition.
You can use any of these members in the import or you can create a new member.
Import an Excel file using the Creation component
To create a page or subpage:
On the menu bar, click Manage .
On the Manage page, click Pages.
In the Pages portal, do one of the following:
- To create a page, click + Page.
- To create a subpage, in the list of pages, click More actions and select + Add subpage.
In the Page dialog box, in the Name field, enter a name for the page or subpage.
From the Page type list, select Blank page.
From the Master layout list, select the layout you want to use.
On the page or subpage, in the Main Zone, click Add component and, in the Add component dialog box, select the Creation component.
Enter a name for the new component and turn the Visible switch to On.
To modify the Creation component:
On the page or subpage, click the Creation component.
On the Creation component detail page, turn the Upload files switch to On.
Turn the Import Excel switch to On.
Click Save and close.
To view the page or subpage, on the Layout tab, click View Page.
In the page preview, click + Add and select Import Excel.
In the Import Excel dialog box, click Select files.
Select the file you want to import and click Open.
When the file is imported, click Done.
Single-level taxonomy using Excel Import
The Excel worksheet must have the name of the taxonomy. In the following example, the name of the taxonomy is BasicTaxonomy, so the name of the worksheet is also BasicTaxonomy.
To import a single-level taxonomy using Excel, create an Excel file with the following columns at a minimum:
- Identifier: this is the identifier for the new taxonomy level that you create using basic dot notation to associate the new taxonomy level with the taxonomy. In this example, the name of the new level is Province, and the taxonomy is named BasicTaxonomy.
- TaxonomyName: the taxonomy name of the taxonomy level.
- TaxonomyLabel#en-US: the optional display label of the taxonomy level. If there are other portal languages, you can import them in the same file.
The Excel worksheet name can stay generic (such as Entities) and contain a Definition column to determine the value of the definitions you wish to import. This table contains the definition names of the entities (up to fifty characters) in their first column. This Entities sheet can support up to fifty definitions. The import ignore columns which do not match the corresponding definition.
The label used for each language column is not the Name, Culture or Label name that is provided during the creation of a portal language. It is the auto-generated Path value that is generated from the Culture field. To see it, from the Manage menu, select Portal languages and next to the language of interest, click Quick edit.
After you import the Excel file, the taxonomy is updated.
In the example above, Province is added to BasicTaxonomy at a new level. You can add other values as well. In the example, two additional fields are added to the BasicTaxonomy taxonomy definition: TaxonomySynonyms and TaxonomyDescription.
When you add a new member to the taxonomy, you can use this member in an Excel file import. For example, a new member called CategoryLabel becomes a column heading in the Excel import file. After the import, when you show the details for BasicTaxonomy, for example, there is a new section titled CategoryLabel.
Multi-level taxonomy using Excel import
To import a taxonomy with multiple levels, an additional field called taxonomyNameToSelf is shown in the definition of the taxonomy. The following example shows a member called BasicTaxonomyToSelf where BasicTaxonomy is the name of the taxonomy. There is both a parent member and a child member.
The order that the members are listed on the worksheet is important. For the correct relationships and hierarchical levels to be created, the worksheet must begin with entities at the first level, followed by subsequent levels.
This flag is included in a field as BasicTaxonomyToSelf:Parent, where BasicTaxonomy is the name of the taxonomy. The parent relationship of the value is a Parent to the new taxonomy entity, so the flag of :Parent is included. The cardinality of the relationship is defined as OneToMany, which means that one BasicTaxonomy entity can be linked to many BasicTaxonomy sub-entities.
In the following example:
- Province is the first level of the taxonomy.
- Leinster is a child of Province.
- Dublin is a child of Leinster.
When this worksheet is imported, the hierarchical levels of the taxonomy are as follows: BasicTaxonomy > Province > Leinster > Dublin
[WARNING] When the order that members are listed on the worksheet is reversed, issues with hierarchical levels arise. For example, if a child level is created before the parent level, the hierarchy is not created, but the relationships are.
In the following example, the third level of the entity is input first, followed by its parent. For the relationship to be created, BasicTaxonomyToSelf:Child is input on the second level entity.
The taxonomy is updated, and the relationship is created with Cork (3rd level) being a child of Munster (2nd level). It is shown as existing under Munster, but the path is not the expected: BasicTaxonomy > Province > Munster > Cork.
Although the relationship is created, the path is incorrect for the taxonomy. Cork exists at the first level of the taxonomy but is a child of Munster. When it was created without the defined path as the second level had not yet been created when this element was imported.
This import sequence means that the child entity is available at two levels in the taxonomy, both the initial level of the taxonomy from the import of this entity, and under the parent because of the relationship. Even if the attempt to correct using both the ToSelf:Parent flag and the ToSelf:Child, the order of creation means that the problem still exists.
You can move the element manually to rectify the problem of multiple versions of the imported child. To do this:
Click Actions next to the entity.
- Navigate to the required parent entity.
- Click Move to here.
This move rectifies the taxonomy so that the hierarchy is available as expected.
Do not delete the child entity at the first level to correct this mis-ordering of an import because it will delete the entity at the other level of the hierarchy.
Can we improve this article ? Provide feedback