Articles in this section
Category / Section

How to upload an Excel file and extract emails from it?

1 min read


You can upload an excel file in UploadBox control and extract the specific column from that excel file.



You can upload an excel file in upload box control by specifying excel file extension is allowed to upload as illustrated in the following code example.







While uploading an excel file, you need to read the data from that excel, extract the specific column and add it to list as shown below code.




private List<MailData> ConvertData(string file)


             List<MailData> list = new List<MailData>();

             ExcelEngine excelEngine = new ExcelEngine();           

             IWorkbook workbook = excelEngine.Excel.Workbooks.Open(file);

             IWorksheet worksheet = workbook.Worksheets[0];

             for (int column = 1; column <= worksheet.UsedRange.LastColumn; column++)

                 if (worksheet.Range[1, column].Value.ToLower() == "mailid")

                     for (int row = 2; row <= worksheet.UsedRange.LastRow; row++)

                         list.Add(new MailData() { MailID = worksheet.Range[row, column].Value.ToString() });



             return list;




Once the uploading process is completed, “complete” client side event will be triggered in our uploadbox control. In that event, you can display the extracted columns which are read from the excel file in argument of complete event.









  function onSuccess(args) {

        if (args.responseText != "")


            $("#maildata").ejListBox({ dataSource: JSON.parse(args.responseText), fields: { text: "MailID" }, height: "200" });


            $("#header").html("E-Mail ID Lis:");





You can download the sample from the following location:

Sample:  Uploadbox Sample
Excel file:  SampleData Excel File


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied