Normally in excel we use merge cells to put a main title then under merged cells we put title for each column, as shown in below picture. is there any way in mendix we can do same thing?
You can't do this with basic Mendix datagrid functionality. If you want something like this i would suggest looking at a different way of styling this.
Depending on your case you could use lay-out grids with fixed headers like for example:
Or use nested dataviews or listviews.