Import Asset(s) using Creation Component
In the previous blog article I covered how to export asset entities to an excel file. In this blog article, I'm going to use the creation component to import the excel file I created from the earlier blog to a new Contenthub instance and see what happens.
Similar to how a selection component is required to provide export to excel functionality, a creation component is needed to provide an import excel functionality in Sitecore content hub.
Before I create the page with the creation component, I'm going to add a couple of columns to the export profile and perform the asset excel download. So, for reference, here is my export profile from the source contenthub instance:
I just have the description and file name columns and then after saving the profile above, I perform export of just a filtered list of assets from the asset detail page I created in my previous blog article:
Exported excel for reference:
In the newly created page, I add the Creation Component and switch on the visible toggle;
For the excel import to work, I switch on the Import Excel toggle, note that although there is an Upload files toggle, it is not relevant to the current scenario of excel upload:
Save the above setting and view the page to see the result of the component addition:
Now, it is time to add the excel exported from the source instance and see what happens:
Once the upload is complete, check the Create page to see any effect of the import but none related to the hero image we uploaded:
So, let's go back to the source content hub instance and modify the export profile to include the title column and see if that has any effect:
Note that the editor throws an error since I didn't add a comma after the "Title" column. Once I added the comma, the error was gone.
This is how my profile looks after saving the "Title" column:
I perform an export through the detail page that has the selection component and here is the excel with the "Title" column added:
I import this new excel into my target contenthub instance:
Since the import is successful, I check the create page to see any effect and I can see an asset with the same name as in the source content hub instance:
So, a "Title" column is mandatory for excel import of assets to be successful!