Toggle dark mode
NickyVadera
technology

How to: Import Option Lists via Excel

Managing multiple option list values in Content Hub can be tedious, but what if there was a way to import or update them all at once? Well, there is! One of Content Hub's hidden gems is the ability to import option list values directly from an Excel sheet. Let's dive into how this works...

Creation component

If you're familiar with the process for importing entities, you can skip this section.

The first thing we're going to need is a creation component that can be used to kick off the import process. To do this, follow these steps:

A screenshot of a correctly configured creation component
  1. Go to Manage > Pages and select the page that you want to use for importing data.
  2. Add a "Creation" component in a suitable place on the page - The header zone (right) is the most usual.
  3. Click on the newly created component to open it's configuration
  4. Enable the "Import Excel" section
  5. Enable the "Enable migration mode" field
  6. Save and close 🙂

Now when you view the page, you will see an "Import Excel" button.

Configure the Excel sheet

The excel sheet should have a single sheet called OptionLists. On this sheet, add the following columns:

  • Name: The name of the option list that the value belongs to
  • Identifier: The identifier for the option list value
  • Label: The label of the option list value in the default culture

Now, add your data; for example:

NameIdentifierLabel
CountriesUKUnited Kingdom
CountriesFRFrance
CitiesLDNLondon
CitiesMKMilton Keynes
CitiesPARParis
CitiesMARMarseille

This sheet can now be imported into Content Hub to insert/update the Counties and Cities values.

Multi Language Lists

If you have multi-language labels, these can simply be added by suffixing the column name with a '#', followed by the culture. For example, Label#en-US or Label#en-FR.

NameIdentifierLabel​#en-USLabel​#fr-FR
CountriesUKUnited KingdomRoyaume-Uni
CountriesFRFranceFrance
CitiesLDNLondonLondres
CitiesEDNEdinburghEdimbourg
CitiesPARParisParis
CitiesMARMarseilleMarseille

Hierarchical Lists

If the option list is a hierarchical data structure, we can also use the excel sheet to manage these relationships; simply add one of both of the following two additional columns:

  • ChildIdentifier: List the identifiers of any child values, separated by a pipe (|)
  • ParentIdentifier: Input the identifier of the parent value

For example, out Countries and Cities option lists can instead be represented by one 'Locations' list:

NameIdentifierChild​IdentifierParent​IdentifierLabel​#en-USLabel​#fr-FR
LocationsUKLDN|EDN|MKUnited KingdomRoyaume-Uni
LocationsFRPAR|MARFranceFrance
LocationsLDNUKLondonLondres
LocationsEDNUKEdinburghEdimbourg
LocationsMKUKMilton KeynesMilton Keynes
LocationsPARFRParisParis
LocationsMARFRMarseilleMarseille
A screenshot showing the option list values having been added

#GoForIt

So there you are, managing option lists in Content Hub just became a whole lot easier. Happy importing!