Hi Nidhin Vijay,
It is not possible to create custom Excel formatting and styling similar to your use case with the default excel export module.
But, yes it is possible to create a custom Excel sheet in Mendix with the use of custom java action. We have created a custom Excel with dynamic columns in one of our projects, by creating a custom java action with apache poi jar library.
Apache poi library will be part of your project if you have downloaded Excel exporter module.
Note: Send the file document object to the java action and save your created Excel file in the file document.
Apache poi References : https://poi.apache.org/components/spreadsheet/quick-guide.html
https://www.codejava.net/coding/how-to-write-excel-files-in-java-using-apache-poi
Good luck with the implementation!!!