logo
logo

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:

  1. On the menu bar, click Manage .

  2. On the Manage page, click Taxonomy and then click New taxonomy.

  3. In the New taxonomy dialog box, in the Name and Label fields, specify a name and label (for example, BasicTaxonomy) and click Create.

  4. 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:

  1. On the menu bar, click Manage .

  2. On the Manage page, click Pages.

  3. 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.
  4. In the Page dialog box, in the Name field, enter a name for the page or subpage.

  5. From the Page type list, select Blank page.

  6. From the Master layout list, select the layout you want to use.

  7. Click Add.

  8. On the page or subpage, in the Main Zone, click Add component and, in the Add component dialog box, select the Creation component.

  9. Enter a name for the new component and turn the Visible switch to On.

  10. Click Add.

To modify the Creation component:

  1. On the page or subpage, click the Creation component.

  2. On the Creation component detail page, turn the Upload files switch to On.

  3. Turn the Import Excel switch to On.

  4. Click Save and close.

  5. To view the page or subpage, on the Layout tab, click View Page.

  6. In the page preview, click + Add and select Import Excel.

  7. In the Import Excel dialog box, click Select files.

  8. Select the file you want to import and click Open.

  9. 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.

Note

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.

Warning

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.

ToSelf:Parent attribute

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

ToSelf:Child attribute

[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:

  1. Click Actions next to the entity.

    .

  2. Select Move.

  3. Navigate to the required parent entity.
  4. Click Move to here.

This move rectifies the taxonomy so that the hierarchy is available as expected.

Warning

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