Where can I find how to import an excel file and upload it to DB through grid control?

Even though I found some examples and related to, but it is not working perfectly on Blazor Web App.

andn though i triy to find it in documents, but all it's about how to export excel.

please help me to find it.

I intend to use it for my invoice page.


3 Replies

PS Prathap Senthil Syncfusion Team February 12, 2024 01:06 PM UTC

Hi LEE,

Before proceeding with the reporting of the problem, we require some additional clarification from your end. Please share the following details to proceed further on our end:

            1. To analyze the reported issue, could you please share a simple and reproducible sample that demonstrates the problem? This will assist us in identifying the issue more efficiently and providing a resolution.
            2. Could you please share the examples or references you found that are not working as expected? This information can help in understanding the specific challenges you're facing.

            3. Could you please clarify how to import an Excel file and upload it to the database through the grid control on your Blazor Web App at your end?

The details requested above will be very helpful in validating the reported query on our end and providing a solution as soon as possible. Thanks for your understanding.

We have a KB for how to import data from an Excel sheet and bind it to a Blazor Grid. Could you please check if it is useful for your scenario?.
Reference :
How to import data from Excel sheet and bind to Blazor Grid? | Syncfusion

Regards,
Prathap S



LE LEE February 13, 2024 02:00 PM UTC

Mr. Prathap S

First of all, thank you for your response, and the link you provided is the same as I already downloaded the code from Github and checked it out (but thanks for letting me know).


First of all, I'd like to talk about some of the issues I see with the above example and explain what I'm looking for in terms of functionality.


The example above isn't a big deal, but it's lacking a couple of things.


1. it's on .Net 7, and I'm on .Net 8, so maybe it has a rendering issue, but the SfGrid isn't refreshed automatically though after uploading the file. Even though I coded it with @rendermode InteractiveAuto or InteractiveServer.

This was solved by using StateHasChanged();.


2. the SfGrid does not clear when I press Delete, Clean on the upload component itself.

This was solved by setting the div to Hidden property.


Next up is the functionality I need.

1. I don't want the uploaded file to be saved on the server, because that file is for temporary and I don't need to save it, it just add up more garbage file in server.

So I tried to read it directly into the memorystream, but I kept getting errors when debugging.

I googled it and found out that it's okay when in production stage and it's only a debugging issue, but I don't have a server yet, so I haven't tried to start that project in production stage.

The error was a timeout error and the final DataTable got the null value.

This is the most urgent feature for me right now, and I keep looking to see if there's another way to implement it, or any tips for using other components, but I've gotten nowhere.


Also, the example has

//write the uploaded memorystream to file stream

            file.Stream.WriteTo(openFileStream);

Isn't memorystream not utilized in this code?


2. and I want to verify the each values in each row of datable, but it is a bigger obstacle for me.

Also ExpandoObject is too difficult for me.

I know ExpandoObject was for converting the datable's all data safely into SfGrid.

Is there any way I can get help with this?


To summarize

1. I want to pass the values directly from memory to the SfGrid without saving the file on the actual server, even if I use the upload component.

2. On conversion, I need the ability to verify each value in the row in a specified format.


Sincerely,

Mr.LEE


Translated with www.DeepL.com/Translator (free version)



PS Prathap Senthil Syncfusion Team February 14, 2024 12:24 PM UTC

Thanks for the update!

Before proceeding with the reporting of the problem, we require some more additional clarification from your end. Please share the following details to proceed further on our end:


           1.To analyze the reported issue, could you please share a simple and reproducible sample that demonstrates the problem?

           2. Are you trying to upload the Excel file in the upload component and then use the memory stream to feed the data into the grid directly? If so, could you please share the step-by-step process with a sample that reproduces the issue?

           3. Could you please share a video demonstration of the issue?

It will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.


Loader.
Up arrow icon