Trying to combine two scripts here:
1) Get a cell value in a specific sheet
function getval() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('master'), true);
spreadsheet.getCurrentCell().offset(2, 4).activate();
};
2) Create a new sheet and rename it according to cell value
spreadsheet.insertSheet(1);
spreadsheet.getActiveSheet().setName('');
The second step is where I struggle. How can I use the results of the getval function as a variable to place inside setName?