Hi Keerthana, In a datagrid you can only export the columns that are present. However there is an option to hide columns in the datagrid, but present in the export. You need to give those columns in the modeler a width of 0. In the browser you don't see those columns, but there present in the excel.
If you want to make the selection made by the end-user, you need a more dynamic solution and the best way is to use the Excel Exporter module. Read this howto on how to use the module: Using the Excel Exporter. But still this solution don't support the user to make the selection of those columns. If you realy need that feature you need to change the module (Java) you're self to give the columns as parameter to be exported.
A last solution is the usage of OData. That allows users to download the data with the usage of Excel, but it isn't an option anymore within Mendix. Read this blog how to configure this: Expose Data to BI Tools Using OData
The export to Excel button simply exports the entire datagrid, no customization possible. You would have to remove the columns in Excel afterwards. If you do want a customizable Excel export you could look at the Excel Exporter in the App store, this requires some additional setup however.