Hi Harshita,
There is no option to export to excel through button in data grid2.
so you need to make an customized export excel option.
To export to exel you can follow this
https://docs.mendix.com/howto/integration/using-the-excel-exporter/
Thanks,