In Spreadsheet, If I select ST on 'Trial' column C0001-ST1 will appear in 'Code' column then if I select SP in 'Trial' column C0002-SP1 will appear in 'Code' column then if I again select ST in 'Trial' column C0003-ST2 will appear in 'Code' column.
Step 1:
Step 2
This is the code that I've now to achieve this.
function incTrialCode(sectionCode) {
if (sectionCode == ""){ return null; }
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var range = sheet.getDataRange();
var values = range.getValues();
for (i=1; i<values.length; i++)
{
trial = values[i][1];
}
return sectionCode + values;
}

