I'm rather new to Google Apps Scripts and I wonder what the difference is between setting an active range and setting an active selection. As far as I understand, while I can set either the active range or the active selection in a sheet, I can get the active range only, but not the active selection. There is also a Range class with specific methods to operate on ranges, but no Selection class.
I have used both set methods,
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
sheet.setActiveRange(sheet.getRange("B5:H20"));
versus
sheet.setActiveSelection(sheet.getRange("B5:H20"));
but can see no difference in the web UI or the behavior.
The Google Apps Scripts documentation for the Sheets class says:
setActiveRange(Range)
Sets the active range for the active sheet.
setActiveSelection(Range)
Sets the active selection region for this sheet.
But I cannot find any information whether to use the one or the other, or which effect they have for the code or the users.