Import Excel file to Kendo Grid using MVC Core - Razor

1 Answer 153 Views
Grid
Gaysorn
Top achievements
Rank 1
Iron
Gaysorn asked on 16 Dec 2022, 01:49 PM

Hi,

I saw the question and answer about import excel file to kendo grid back in 2020. Do you have any update on the topic or do you have samples? I have the project that our customers want to import data from excel file to the database. They want to see data in the grid before save to table in database. Is it possible? Any advice. Thank you.

 

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 21 Dec 2022, 11:59 AM

Hi Gaysorn,

Thank you for reaching out.

This is something that the Grid widget does not support out of the box, but you can take a look at the custom implementation demonstrated in the the following knowledge base article:

The specified sample internally relies on the creation of a "textarea" which will act as a clipboard. From there, the pasting of arbitrary content is handled with the conventional onpaste event, the content is trimmed, and is further serialized to object instances that are passed to the Grid's data. 

Although the sample targets the Kendo UI for jQuery suite, the same approach is also applicable for the Telerik UI for ASP.NET Core Grid as well:

For your convenience, here is a runnable Telerik REPL example that further depicts this:

Notice, that the sample targets a read-only Grid scenario. This is expected due to the user being unable to edit the records as there is an invisible textarea above the table that prevents this functionality. Thus, you can reviewe the following example as well that tackles an identical approach to the aforementioned one if CRUD operations are a mandatory requirement:

I hope this helps.

Kind Regards,
Alexander
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Gaysorn
Top achievements
Rank 1
Iron
Answers by
Alexander
Telerik team
Share this question
or