Skip to content

DataGrid export to Excel #6042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
stsrki opened this issue Mar 27, 2025 · 2 comments · May be fixed by #6067
Open

DataGrid export to Excel #6042

stsrki opened this issue Mar 27, 2025 · 2 comments · May be fixed by #6067
Assignees
Milestone

Comments

@stsrki
Copy link
Collaborator

stsrki commented Mar 27, 2025

https://blazorise.com/support/issues/273#comment_2360

We need to see how complex this might be. One thing I am certain of is that we don't want it as part of the DataGrid project. So, the only other way is to create a separate Blazorise project.

We can make it so that we can convert any Data to Excel, XML, CSV, or whatever we can think of.

Now, the only problem is how we connect this "project" with DataGrid. Because users can interact with DataGrid export through the context menu or through the Export button. Or anything else.

I'm open to proposals.

@stsrki stsrki added this to the 1.8 milestone Mar 27, 2025
@tesar-tech
Copy link
Collaborator

"Export to Excel" can have two interpretations:

  • "Give me an .xlsx or .xls file"
  • "Give me something I can open in Excel"

In most cases, users expect the second behavior when they click "Export to Excel".

This can be achieved relatively easily using CSV. Excel will automatically apply its own formatting once any (even minor) edits are made within the spreadsheet.

Proposal:
Start with CSV support. Build this functionality directly into Blazorise.DataGrid with extensibility in mind, so that it can be easily integrated with external projects later (Blazorise.DataGrid.Excel). This will allow us to plug in full Excel export functionality (e.g., generating .xlsx) later, while satisfying the "open in excel" majority now.

@stsrki
Copy link
Collaborator Author

stsrki commented Apr 3, 2025

I think we can add Task<string> ExportToCsv() to DataGrid. We could also pass it an argument to define what to export.

Proposal:

enum DataGridExportInfo // find better name 
{
  CurrentView,
  AllData,
}

then

Task<string> ExportToCsv(DataGridExportInfo info)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants