Hi Nidhin,
you could use the Excel Exporter module in the marketplace to create your custom logic before the export.
A good documentation how to use it can be found in the docs and in the academy.
I created a logic which takes the list of users and creates a string (e.g. UserListAsString).
Please find below my solution (this might not be the best way, I am open for other suggestions).
Domain Model
Department DataGrid
Excel Export Action Button Configuration
ACT_DepartmentExcelExport Microflow
SUB_UserListAsString Microflow
Excel Exporter Template
Excel Export