# Customizing the Excel Export Filename of the Grid by Adding Current Date and Time

## Environment

<table>
	<tbody>
        <tr>
			<td>Product</td>
			<td>Grid for Progress® Telerik® UI for ASP.NET MVC</td>
		</tr>
	</tbody>
</table>

## Description

How can I add the current date and time to the Excel export filename of the Grid when working with the Telerik UI for ASP.NET MVC components?

## Solution

Use the [`excelExport`](https://docs.telerik.com/kendo-ui/api/ui/grid/events/excelexport) event which has the workbook in its event data to rename it.

With the help of the [`kendo.toString()`](https://docs.telerik.com/kendo-ui/globalization/intl/dateformatting) method or another way to format the date, concatenate the date to the filename.

```Razor Index.cshtml
@(Html.Kendo().Grid<GridExportCustomName.Models.OrderViewModel>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(e => e.OrderID);
        columns.Bound(e => e.Freight);
    })
    .ToolBar(t => 
    {
        t.Excel();
    })
    .Events(ev=>ev.ExcelExport("onExcelExport"))
    .DataSource(dataSource => dataSource
        .Custom()
        .Type("odata-v4")
        .Transport(transport =>
           transport.Read(read => read.Url("https://demos.telerik.com/service/v2/odata/Orders"))
        )
        .PageSize(10)
    )

)
```

```JS script.js
    function onExcelExport(e) {
        e.workbook.fileName = kendo.toString(new Date, "dd/MM/yyyy HH:mm") + " Grid.xlsx";
    }
```

## More ASP.NET MVC Grid Resources

* [ASP.NET MVC Grid Documentation](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/data-management/grid/overview)

* [ASP.NET MVC Grid Demos](https://demos.telerik.com/aspnet-mvc/grid/index)

* [ASP.NET MVC Grid Product Page](https://www.telerik.com/aspnet-mvc/grid)

* [Telerik UI for ASP.NET MVC Video Onboarding Course (Free for trial users and license holders)](https://www.telerik.com/aspnet-mvc/documentation/getting-started/video-onboarding)

* [Telerik UI for ASP.NET MVC Forums](https://www.telerik.com/forums/aspnet-mvc)

## See Also

* [Client-Side API Reference of the Grid for ASP.NET MVC](https://docs.telerik.com/kendo-ui/api/ui/grid)
* [Server-Side API Reference of the Grid for ASP.NET MVC](https://docs.telerik.com/aspnet-mvc/api/grid)
* [Telerik UI for ASP.NET MVC Breaking Changes](https://www.telerik.com/aspnet-mvc/documentation/backwards-compatibility/2023-backwards-compatibility)
* [Telerik UI for ASP.NET MVC Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
