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:
- Go to Manage > Pages and select the page that you want to use for importing data.
- Add a "Creation" component in a suitable place on the page - The header zone (right) is the most usual.
- Click on the newly created component to open it's configuration
- Enable the "Import Excel" section
- Enable the "Enable migration mode" field
- 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:
Name | Identifier | Label |
---|---|---|
Countries | UK | United Kingdom |
Countries | FR | France |
Cities | LDN | London |
Cities | MK | Milton Keynes |
Cities | PAR | Paris |
Cities | MAR | Marseille |
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.
Name | Identifier | Label​#en-US | Label​#fr-FR |
---|---|---|---|
Countries | UK | United Kingdom | Royaume-Uni |
Countries | FR | France | France |
Cities | LDN | London | Londres |
Cities | EDN | Edinburgh | Edimbourg |
Cities | PAR | Paris | Paris |
Cities | MAR | Marseille | Marseille |
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:
Name | Identifier | Child​Identifier | Parent​Identifier | Label​#en-US | Label​#fr-FR |
---|---|---|---|---|---|
Locations | UK | LDN|EDN|MK | United Kingdom | Royaume-Uni | |
Locations | FR | PAR|MAR | France | France | |
Locations | LDN | UK | London | Londres | |
Locations | EDN | UK | Edinburgh | Edimbourg | |
Locations | MK | UK | Milton Keynes | Milton Keynes | |
Locations | PAR | FR | Paris | Paris | |
Locations | MAR | FR | Marseille | Marseille |
#GoForIt
So there you are, managing option lists in Content Hub just became a whole lot easier. Happy importing!