This is a migrated thread and some comments may be shown as answers.

Upload Spreadsheet and read

17 Answers 1722 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Jose
Top achievements
Rank 1
Jose asked on 10 Apr 2017, 09:55 PM

Do you have sample code that would allow me to upload a spreadsheet and read it, looping through each row and column using built-in functions/procedures from Telerik UI for ASP.NET?

I see you have samles in: http://demos.telerik.com/aspnet-core/spreadsheet/index. None of them though show how to upload the file and read the file using Telerik UI for ASP.net. Please advise

 

 

 

17 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 13 Apr 2017, 10:34 AM

Hello Jose,

Yes, you can check out this demo here: http://demos.telerik.com/kendo-ui/spreadsheet/server-side-import-export

Regards,
Ianko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jose
Top achievements
Rank 1
answered on 13 Apr 2017, 02:33 PM
Thanks - but what I meant was doing server-side processing - upload the file, then in my controller or service class, I'll use the some of the built-in Kendo procedures to loop through each row and do my processing. after processing, I then redirect to the page where I uploaded the file showing some sort of status message. I am using ASP.Net core btw. 
0
Ianko
Telerik team
answered on 18 Apr 2017, 05:40 AM

Hello Jose,

If I understand you properly, the Kendo Spreadsheet component is actually never used and the topic here addresses server-side processing of Spreadsheet documents. For processing documents on the server, we offer the Telerik Document Processing library (http://docs.telerik.com/devtools/document-processing/introduction). And for spread processing, you can navigate here: http://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/overview. However, Telerik Document Processing still does not NET Core: http://docs.telerik.com/devtools/document-processing/installation-and-deployment/system-requirements

The Kendo Spreadsheet widget and ASP.NET Core component utilize client-side funcitonality for importing and exporting Excel files. http://docs.telerik.com/kendo-ui/controls/data-management/spreadsheet/import-and-export-data/server-side-processing. Server-side processing is again supported only for the non-Core .NET Framework. 

Regards,
Ianko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Christian Sandöy
Top achievements
Rank 2
answered on 24 Sep 2018, 09:26 AM

How do I show a xlsx file in asp.net core

Do i have to convert it to json first?

0
Ianko
Telerik team
answered on 25 Sep 2018, 06:01 AM
Hello Christian,

That would be the best option currently if you have a service that transforms an Excel file to JSON. The Document Processing libraries does not support .NET Core yet.

Regards,
Ianko
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.
0
Christian Sandöy
Top achievements
Rank 2
answered on 25 Sep 2018, 10:02 AM
I think it is bad that a spreadsheet control cant op an excel file
0
Ianko
Telerik team
answered on 26 Sep 2018, 06:53 AM
Hi Christian,

The component itself can load Excel data when, but as this is a client-side widget you cannot somehow feed it with a stream of Excel file. The data should be client-side compatible. For MVC scenarios we have the option to use the Document Processing libraries. The Core support is under  development and you can track its status here: https://feedback.telerik.com/Project/184/Feedback/Details/198399-document-processing-provide-version-for-net-core.


Regards,
Ianko
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.
0
Christian Sandöy
Top achievements
Rank 2
answered on 09 Oct 2018, 11:55 AM

Why can I do this i .net core

@{var path = Server.MapPath("~/App_Data/path/to/document.xlsx");

var workbook = Telerik.Web.Spreadsheet.Workbook.Load(path);}

@(Html.Kendo().Spreadsheet().Name("spreadsheet").BindTo(workbook))

0
Ianko
Telerik team
answered on 10 Oct 2018, 02:05 PM
Hi Christian,

The Telerik.Web.Spreadsheet assembly is available only with the Kendo UI for ASP.NET MVC. It is not shipped with the Kendo UI for ASP.NET Core suite. This is because the Telerik.Web.Spreadsheet assembly depends on the Telerik Document Processing libraries that currently are not supported in .NET Core. 

Regards,
Ianko
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.
0
Christian Sandöy
Top achievements
Rank 2
answered on 10 Oct 2018, 02:22 PM
When will the Telerik Document Processing libraries be supported i .net core?
0
Ianko
Telerik team
answered on 10 Oct 2018, 02:29 PM
Hello Christian,

The original feature request on this task is logged here: https://feedback.telerik.com/Project/184/Feedback/Details/198399-document-processing-provide-version-for-net-core. You can follow it by clicking Follow this item. That way you will get notifications on updates. You can also post a comment on the thread with any additional feedback that you have in mind.

Regards,
Ianko
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.
0
Christian Sandöy
Top achievements
Rank 2
answered on 30 Oct 2018, 10:03 AM

The Document Processing libraries does not support json
so I cant use it to convert excel files to json 

How can I show Excel fil in .net core when You dont have a way to convert files to the only format the control support?

0
Ianko
Telerik team
answered on 30 Oct 2018, 10:55 AM
Hello Christian,

When the Document Processing libraries are supported for .NET Core, the Telerik.Web,Spreadsheet assembly will be shipped along with the Telerik UI for ASP.NET Core suite just like it is now with the MVC suite (https://demos.telerik.com/aspnet-mvc/spreadsheet/server-side-import-export). That will enable xlsx import and export out of the box without the hassle to take car of JSON conversion on your own. 

Shortly, in the MVC suite, it is the Telerik.Web.Spreadsheet assembly that makes that conversion and handles xlsx files by utilizing the Document Processing libraries. 

Regards,
Ianko
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.
0
Christian Sandöy
Top achievements
Rank 2
answered on 30 Oct 2018, 12:31 PM

I found a way to load a Excel file from server i .net Core

var xhr = new XMLHttpRequest();
xhr.open('GET', '/Dokumenter/Drejebog/EntreRegler.xlsx', true);
xhr.responseType = 'blob';
xhr.onload = function (e) {
if (this.status == 200) {
// get binary data as a response
var blob = this.response;
var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
spreadsheet.fromFile(blob);
}
};
xhr.send();

0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 04 Nov 2020, 05:06 PM

It's the end of 2020 and still no examples for Server Import/Export in ASP.NET Core Spreadsheet. Also I can't find the Telerik.Web,Spreadsheet assembly that Ianko mentioned.

What I like to do is:

1. Load an Excel-file from server and display it in ASP.NET Core Spreadsheet Component (inside Get-method of PageModel); this means I have to somewhat bind the file from my PageModel to the component
2. Let user change some cells
3. Save the file in a database and reload it later on from there.

How can this be achieved?

Regards
Heiko

0
Scott
Top achievements
Rank 1
Veteran
answered on 05 Nov 2020, 12:59 PM

Heiko,

I found this in the 2020.3.195 release: https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/import-and-export-to-excel-file-formats/xlsx/xlsxformatprovider. My issue is I can't figure out how to process it. All the examples are for making a workbook, not reading one.

Telerik.Windows.Documents.Spreadsheet.Model.Workbook workbook;
IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();
  
using (Stream input = new FileStream(fileName, FileMode.Open))
{
    workbook = formatProvider.Import(input);
}
0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 05 Nov 2020, 01:51 PM

Hi Scott,

thanks for your input. I use the document processing libraries from Telerik in other projects so: yes, I know how to load and save a file via FormatProviders, but the missing link is how to connect the workbook with the spreadsheet component.

I took your example from above (30 Oct 2018) and it works quite good, except for all values in my cells are gone. Formatting and formulas are ok, but the rest of the sheet is empty. I'm considering switching to a different component from another provider.

Regards
Heiko

Tags
Spreadsheet
Asked by
Jose
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Jose
Top achievements
Rank 1
Christian Sandöy
Top achievements
Rank 2
Heiko
Top achievements
Rank 1
Iron
Veteran
Scott
Top achievements
Rank 1
Veteran
Share this question
or