Angular Excel Export Data Binding
The Excel Export component exports the collection assigned to its data input. Bind a local collection directly, or retrieve data from a remote service before you export it.
Binding to Local Data
Use a local array when the data is already available in your application. Bind the collection to the data input, then define kendo-excelexport-column elements for the fields that you want to export.
<kendo-excelexport [data]="products" fileName="Products.xlsx" #excelExport>
<kendo-excelexport-column field="ProductID" title="Product ID">
</kendo-excelexport-column>
<kendo-excelexport-column field="ProductName" title="Product Name">
</kendo-excelexport-column>
</kendo-excelexport>
The following example demonstrates how to export a local collection.
Binding to Remote Data
You can bind the Excel Export component to data from a backend service, REST API, or another remote source. Retrieve the data through HttpClient or your application's data-access layer, then assign the received collection to the data input. The component exports the collection that is currently assigned to data.
<button kendoButton type="button" (click)="excelExport.save()">Export to Excel</button>
<kendo-excelexport [data]="products" fileName="Products.xlsx" #excelExport>
<kendo-excelexport-column field="ProductID" title="Product ID"></kendo-excelexport-column>
<kendo-excelexport-column field="ProductName" title="Product Name"></kendo-excelexport-column>
<kendo-excelexport-column field="UnitPrice" title="Unit Price"></kendo-excelexport-column>
</kendo-excelexport>The following example demonstrates how to export a collection retrieved from a remote service.
When a remote service returns data in pages, request the complete collection before calling save(). For Grid-specific server paging and the fetchData callback, see Exporting Data from Remote Sources.
Mapping Remote Data Fields
When the fields are known only after the remote service responds, use the received collection to create the Excel Export columns.
<button kendoButton type="button" (click)="excelExport.save()">Export to Excel</button>
<kendo-excelexport [data]="products" fileName="Products.xlsx" #excelExport>
@for (field of fields; track field) {
<kendo-excelexport-column [field]="field" [title]="field">
</kendo-excelexport-column>
}
</kendo-excelexport>The following example demonstrates how to create export columns from the fields of a remote data source.
Use this approach when every data item has the same fields. Use a server-provided schema or an explicit column mapping when you need custom titles, column order, hidden fields, or formatting.