Import (Paste) from Excel
Environment
| Product | Grid for Blazor |
Description
How to import (paste) content in the Grid from Excel instead of using the built-in way for creating new items?
Solution
The Grid does not provide a built-in paste-from-Excel feature. An example that captures the clipboard content, parses the pasted rows, and adds them to the Grid data source is available in the following project: Import (Paste) from Excel.
Use this approach when users paste a variable number of spreadsheet rows and you need to save each row as a database record. Adapt the parsing and validation logic to your model, then persist the valid items in your application.
The sample uses a separate input to capture the pasted text. Review the sample's UX limitations before applying it to a Grid that also needs editing, keyboard navigation, filtering, or text selection.
If users need an Excel-like editing surface before saving, use the Spreadsheet and read its values after calling ExportToExcelAsync() as described in Iterate Spreadsheet Data and Get Cell Values.