Import Data from Excel Sheet using Sheer UI Dialog in Sitecore

One of the most common functionalities that you would likely work on is import from Excel file. In one of our Sitecore sites, we had a Sheer UI application that would save different kind of data that users can add manually through a popup dialog. This would be a straight forward functionality until you start to have a huge amount of data to be imported in the system and it always will end in having an excel file with all data and you need to import it to the site.


To have this work in a Sheer UI application in Sitecore, you have to put in mind a number of considerations:

  • There is no Sitecore control you can use directly to browse for files and upload data. The File control introduced in Sitecore is mainly used for Media Items where the Browse button will open the Media Library Tree.
  • We can always use ASP.Net controls with Sitecore. Keeping in mind how these controls work and how to implement our functionality based on that.
  • When we use ASP.Net/HTML upload control, we need first to upload the file to the server and then import data from the file. This means we need to have a post back to the server before we have the data file in hand.


Step 1: Create XML Layout
Based on the above, we created a XAML file (.xaml.xml) to hold our File Upload control, Upload and Import buttons.

Step 2: Implement Upload Functionality
You can see that by adding the ASP.Net file upload, we used a submit button to upload the data to the server. You can implement the file upload the way you wish. Below, a sample code for doing that.

Step 3: Close Dialog and Call Import Command
Once the file is uploaded to the server, we need to:

  • Read data from the Excel sheet and Save data.
  • Close the Sheer UI dialog.

To do this, we had the import button do the following:

This will call the Sheer UI dialog OK_Click event that would close the dialog and call the command defined for saving the imported data defined in the configurations.

Step Four: Implement Save Functionality

In this step, we parsed the parameters passed from the Sheer UI application including:

  • File name including the location of the file.
  • Current user, in order to run the progress box under a Sitecore logged in user.

We used CSharpJExcel.dll library to read the Excel sheet file and through the sheets columns.

This was a simple walkthrough on how to create a XAML Popup Dialog to import data from Excel file in Sitecore.


One thought on “Import Data from Excel Sheet using Sheer UI Dialog in Sitecore

  1. Pingback: Re-blogged: Import Data from Excel Sheet using Sheer UI Dialog in Sitecore | Sitecoring

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s