Excel export and Export Profile inter-relationship in Sitecore Content hub

Pre-requisite: Sitecore Contenthub Sandbox 4.1.1

The selection component with search component is a vital combination in Sitecore Contenthub since they help in data export. It is needless to say that data export and import are very important features in any application. So, here I cover how to export data in Sitecore Content hub using an export profile. Note that you can edit an export profile to your needs so that you can export only the needed data.

So, over to the step-by-step approach: 

In order to use the excel export option, a search component is a pre-requisite. I already have a detail page with a search component and its settings looks  as follows:

System filter setting:


Note that I chose M.Asset schema since it  already has pre-filled data but you can choose your own entity/schema!

Here is my output tab for reference:


Nothing fancy here too, I chose  the table output since I thought it goes well with the concept of export!

Before adding the selection component to the same page as the search component, an export profile needs to be created. Export Profiles are accessible from the Manage area of the content hub:



Create a new export profile and link it to the M.Asset entity:


Note that I copied over the Settings as a text from the existing AssetProfile and made this new profile as default. 

Now,  I add my Selection component to the same page. The selection component is the one that has export to excel toggle and as a pre-requisite, it needs a search component on the page!


Here is the general settings in my selection component:

Note that the export to excel toggle is on and Linked search component must point to the search component in the page!

Operations tab for reference:


Next, time to check the effect on the page:

This is how my page looks with the search and selection component and by default, there is an export to excel button there on top of the table:



Once I press the export to excel button, since I have 44 rows selected, the excel name can be keyed-in as part of the export job:



The export excel gets queued as a job in the background process:


Once finished, on checking the download, the generated excel has the following columns:



Now, I go back to my export profile and make the following changes so that I get rid of relation-related columns as well as the default columns like created date etc.


Note that if you want to get rid of any columns like FileName, remove it from the properties list in the above text.

Now press the save button, rerun the export and this should be the excel output:


Now, I go back to the export profile and get rid of all the columns in the properties list and see what happens:



Save profile and rerun the export to see a blank excel:


On the other hand, if I add a random FileName column to the export profile properties and re-run the export, this is the result:



So, id and identifier columns are added by default whenever you add any column as part of the properties list in the export profile!


Comments

Popular Posts