Import Data from Excel file
1 Answer 190 Views
Daochuen
Top achievements
Rank 1
Daochuen asked on 09 Dec 2019, 05:45 PM
Hello,

Our MVC/Kendo project utilized Telerik.Documents.SpreadsheetStreaming library to export data to Excel file. Now we'd like to do reverse process - IMPORT process which read data from physical location (through file system or from database) to C# object. I didn't find related Interface or method in Telerik.Documents.SpreadsheetStreaming. Could someone point out which library is the better way to do so. Thanks  in advance!

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin
Telerik team
answered on 11 Dec 2019, 12:19 PM

Hello Zhihong,

Currently, the SpreadStreamProcessing library supports only generating and exporting of spreadsheet documents. We have a feature request logged in our backlog to implement workbook import. You can cast your vote for the implementation as well as subscribe to receive updates about status changes using the related public item: SpreadStreamProcessing: Implement workbook import.

If this matches the case, I would like to suggest you to check the SpreadProcessing library which supports importing and editing of existing documents as well as exporting them to several file formats. For more information about the SpreadProcessing`s supported formats, please check the General Information help topic.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Thanks Martin for responding.

I heard someone said following library could do the importing. What's your suggestion? Does that group dll came from Kendo UI? If so, Where Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll located? If not, what software we need purchase?  Thanks.

Telerik.Web.Spreadsheet.dll
Telerik.Windows.Documents.Core.dll
Telerik.Windows.Documents.Spreadsheet.dll
Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll
Telerik.Windows.Zip.dll
- by
Daochuen
Top achievements
Rank 1
on 11 Dec 2019, 05:23 PM

Hello Zhihong,

The mentioned binaries are part of the Telerik Document Processing libraries (except Telerik.Web.Spreadsheet.dll which is part of Telerik UI for ASP.NET AJAX). Document Processing is distributed as part of different packages, including Telerik UI for ASP.NET MVC and is available for the Telerik UI Enterprise and DevCraft bundles as well. For more information about the installation and where to find the binaries of Telerik Document Processing libraries, please, check the Installing on Your Computer help topic. Since the thread has been initially submitted for UI for ASP.NET MVC, if you already have an installation of this package, you can find the document processing related binaries in the spreadsheet folder of your local installation.

In order to import or export one of the supported file formats, you will need to use the specific format provider. For more information about the formats and conversion, please, check the General Information help topic.

Here is a simple example of importing an existing XLSX file using the XlsxFormatProvider:

string fileName = "SampleFile.xlsx";
Workbook workbook;
IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();

using (Stream input = new FileStream(fileName, FileMode.Open))
{
	workbook = formatProvider.Import(input);
}
Regards,
Martin
Progress Telerik

 

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
- by
Martin
Telerik team
on 13 Dec 2019, 07:24 AM
We used Virtual Machine and cannot find related folder. Can I download particular dll file somewhere?  Thanks.
- by
Daochuen
Top achievements
Rank 1
on 16 Dec 2019, 03:35 PM

Hello Zhihong,

You can download the required binaries from your Telerik profile as well: https://www.telerik.com/account/my-downloads. When you select from the available products in your subscription there is a list with all included files including the Telerik Document Processing binaries (if they are distributed with it. For more information check: Telerik Document Processing is part of several Telerik bundles). In case there are .nugpk files listed, you can extract the package and to find the relevant binary in the lib folder.

Let me know if you have additional questions.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
- by
Martin
Telerik team
on 17 Dec 2019, 01:21 PM

Thanks Martin,

I still have questions:

1. I didn't  find Telerik.Web.Spreadsheet.dll in my download site. As you mentioned Telerik.Web.Spreadsheet.dll  is the part of Telerik UI for ASP.NET AJAX. I download Telerik UI for ASP.NET AJAX and still not found it (Please see attached image). Do I have the way to download it?

2. I actually want to read every cell data from excel file. Could you provide piece of code to read data from cell level?  I am not sure which library is best for that.   Thank you very much!

- by
Daochuen
Top achievements
Rank 1
on 19 Dec 2019, 05:39 PM
Hi Martin,
I download Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll and added it in our project but build failed for complaining the version number was higher than it should be. Where I can find below old version dlls to fit our project’s need ? The version of Kendo.Mvc we used is 2016.3.1118.545. Thanks for your continuing support.

Telerik.Web.Spreadsheet.dll
Telerik.Windows.Documents.Core.dll
Telerik.Windows.Documents.Spreadsheet.dll
 Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll
Telerik.Windows.Zip.dll
- by
Daochuen
Top achievements
Rank 1
on 19 Dec 2019, 09:51 PM

Hello Zhihong,

I am attaching you a screenshot where you can find the Telerik.Web.Spreadsheet.dll. 

The Telerik Document Processing libraries provide two libraries for XLSX files processing: RadSpreadStreamProcessing (this library provides only export functionality) and RadSpreadProcessing which provides import/read XLSX, CSV, and TXT file formats. For more information, you can check the main differences between these two libraries.

After the spreadsheet document is imported you can create a CellSelection using a CellIndex or a CellRange in order to manipulate the data and properties of the cells. For more information and examples you can check Accessing Cells of a Worksheet and Get, Set and Clear Cell Properties help topics. I wrote a simple code snippet demonstrating this functionality, so please, see the following example:

string fileName = "SampleFile.xlsx";
Workbook workbook;

IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();
using (Stream input = new FileStream(fileName, FileMode.Open))
{
	workbook = formatProvider.Import(input);
}

Worksheet worksheet = workbook.Worksheets[0];
CellSelection selection = worksheet.Cells[1, 1];

ICellValue cellValue = selection.GetValue().Value;

As for the older binaries version, from the Versions dropdown (from your Telerik account) you can select an older version to download:

Please note that if you do not see the desired version you can contact our sales team and they will enable the version for download.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
- by
Martin
Telerik team
on 23 Dec 2019, 05:53 AM

Martin,

Thanks for screenshots. But I do not have that screen. Please see the screenshot from my account download site.

- by
Daochuen
Top achievements
Rank 1
on 23 Dec 2019, 04:36 PM
Sorry, I realized Version Dropdown list inside particular download page. I found it. Thanks Martin!
- by
Daochuen
Top achievements
Rank 1
on 23 Dec 2019, 05:10 PM
how to read xls in telerik.
- by
Suresh Kumar
Top achievements
Rank 2
on 29 Jun 2020, 07:13 AM

Hello Suresh,

I am sorry to hear you are experiencing issues due to a currently not supported functionality. Presently, the SpreadProcessing library doesn't support import (or export) of XLS documents. We have an item logged in our backlog to provide such functionality: SpreadProcessing: Support for import and export of .XLS documents. You can cast your vote for the implementation as well as subscribe to the task by clicking the Follow button so you can receive updates about its status changes.

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
- by
Martin
Telerik team
on 29 Jun 2020, 09:01 AM
Asked by
Daochuen
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or