Export Excel with new Sheet and data into cells
Im trying to export to excel, with a new sheet and data written into the new sheet
Im using the 31.2.15 version which works sheet renaming
But Im unable to set the data in another WorkSheet
That is what Im trying:
When opening the excel I get the warning:
New sheet apperars on the document
But there is no data into them:
Hi
Daniel,
Thanks for patient,
We reviewed your query and understand that you want to add an extra worksheet,
assign a custom name, and set values in that worksheet. However, the export
does not work correctly on your end. After checking your code snippet, we found
that after adding rows and cells, you need to set the Index for both the row
and the cell to ensure the data exports correctly. Please refer to the
following code snippet and sample for more information.
Sample : https://blazorplayground.syncfusion.com/BXVSsVtzLgbjyIAN
|
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args) { if (args.Item.Id == "Grid_excelexport") {
ExcelExportProperties exportProperties = new ExcelExportProperties(); exportProperties.FileName = $"Relatorio de Projetos.xlsx"; exportProperties.IncludeTemplateColumn = true; // Add a new workbook to the Excel document that contains only 1 worksheet. exportProperties.Workbook = new Workbook();
// Rename the first sheet (Grid data will be exported here) exportProperties.Workbook.Worksheets[0].Name = "Relatório";
// Define the Gridsheet index where Grid data must be exported. exportProperties.GridSheetIndex = 0;
exportProperties.Workbook.Worksheets.Add();
Syncfusion.ExcelExport.Worksheet sheet2 = exportProperties.Workbook.Worksheets[1];
sheet2.Name = "Resumo"; Syncfusion.ExcelExport.Row row1 = sheet2.Rows.Add();
row1.Index = 1; Syncfusion.ExcelExport.Cell cell1 = row1.Cells.Add(); cell1.Index = 1; cell1.Value = "teste";
Syncfusion.ExcelExport.Cell cell2 = row1.Cells.Add(); cell2.Index = 2; cell2.Value = "Teste";
Syncfusion.ExcelExport.Cell cell3 = row1.Cells.Add(); cell3.Index = 3; cell3.Value = "Tetse";
await Grid.ExportToExcelAsync(exportProperties);
} } |
Regards,
Naveen
- 1 Reply
- 2 Participants
-
DA Daniel
- Nov 27, 2025 03:12 PM UTC
- Dec 4, 2025 07:14 AM UTC