BlazorTable icon indicating copy to clipboard operation
BlazorTable copied to clipboard

Export datatable to Excel and/or CSV

Open pqbui001 opened this issue 4 years ago • 3 comments

This is a suggest feature, is it possible to add export to Excel and/or CSV feature? I think this is an essential feature to have for datagrid. Thanks for consideration.

pqbui001 avatar May 12 '20 21:05 pqbui001

I think the CSV export can be implemented very easily. See the following Issue which shows how to retrieve the Filtered Items, https://github.com/IvanJosipovic/BlazorTable/issues/118

I'll think about If I would like this functionality directly in BlazorTable.

IvanJosipovic avatar May 13 '20 15:05 IvanJosipovic

@IvanJosipovic

Hey, I had a similar need for exporting to CSV, but I needed the rendered version of the data (like, if you have a custom template for a column).

I couldn't see any way to do this without actually putting all filtered items (ignoring pages) on the DOM in a hidden div, getting all of the rendered text with a JS interop, then finally saving it as a CSV. This puts some strain on the browser having to put everything on the DOM like that, but it works.

Do you know of a better way to do this? I don't know if there's a way to get the text from a RenderFragment without actually putting it on the DOM first, but this would help immensely and would cut down on in-browser memory usage as well.

I can show you my solution if you'd like as well.

kwhv23 avatar Jan 12 '21 23:01 kwhv23

@IvanJosipovic I'm having a client project where we need this feature, can we pay you to implement this instead of me having to do it outside BlazoredTable.?

Personally I don't think this feature should be a on pr default, but a option we can turn on, like a "download csv" button. It would solve the requirement, and would have a better feel than whatever I can implement.

We don't need excel support, just plain old csv.

christopher-bonitz avatar Feb 25 '21 12:02 christopher-bonitz