Hi Nikhil,
Did you check this section of the documentation?. It explains the capabilities of export to excel from the Datagrid 2. Be aware that this behavior is only possible with the DataGrid 2 variant that is part of the Data Widgets Module. If you are using an older version: read this on how to upgrade
Update:
Filtered data based on SchoolYear
Example of the DataGrid, Nanoflow button and XLS file
Below you can see the Datagrid in Structure mode
And this is the associated nanoflow
The regular datagrid has the export option as well (when using xpath as your datasource)
You can add additional columns to your datagrid and hide them. When you export to Excel, these are still included.
Two ways of hiding them are: Select 0 width
or add the class 'hidden' to the column you don't want to display