Add Group in a Macro

Is it possible to add a group in a macro so that when the macro is dropped in DiagramDiv it expands to show the group inside it and components of that group remain at their position as predefined?

Yes, I do not see why that would not be possible.

myDiagram.addDiagramListener(“ExternalObjectsDropped”, function(e) {
this code is ungrouping all the groups inside
Is there any way to just ungroup only first group which the macro?

Change what is selected before calling CommandHandler.ungroupSelection.