Get Active row and set column

I would like this script to get the active row and set column and add to my result in the script. I can get the script to look at a range but not one cell value on the active row. I want column 6 data from the active row. This data is displaying in an HTML pop-out box. When it runs it look at this script to fill in one of the boxes on the pop-out box. Please help, thanks.

function studentid() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Your Region List');
var values = sheet.getRange(2, 6,sheet.getLastRow() - 1);
var result = new Array(values.getLastColumn() - 1);
for(i =0; i < 25; i++) {
result[i] = values.getCell(i + 1, 1).getValue();
}
return result;

Solution 1:

You can get active range using getActiveRange()

Then you can get the column 6 value of active row like this :

var active_range = sheet.getActiveRange();
var value = sheet.getRange(active_range.getRowIndex(), 6).getValue();
Logger.log(value);

References and further reads :

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#getactiverange

https://developers.google.com/apps-script/reference/spreadsheet/range#getrowindex