The array property GroupNr allows to access the spectral group of the layer specified by the parameter Layer. If you assign a group number to a non-existent layer (i.e. if the parameter Layer is less than 1 or greater than NLayers) the call will be ignored on write or return a zero value on read.
Hint:
In order to access the spectral collection currently loaded in the Spectral Collection Editor you can use the pre-declared global variable SCData.