I have a list of tasks, and I want to create a macro to add a row bellow the last item to that list. But all the macros that i've tried didnt work. Can someone help me with this?
here it is:
function AddRow() {
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getActiveSheet();
sheet.getRange(spreadsheet.getCurrentCell().getRow() + 22, 1, 1, sheet.getMaxColumns()).activate();
spreadsheet.getActiveSheet().insertRowsAfter(spreadsheet.getActiveRange().getLastRow(), 1);
spreadsheet.getActiveRange().offset(spreadsheet.getActiveRange().getNumRows(), 0, 1, spreadsheet.getActiveRange().getNumColumns()).activate();
spreadsheet.getCurrentCell().offset(0, 8).activate();
spreadsheet.getCurrentCell().setFormulaR1C1('=TODAY()');
spreadsheet.getCurrentCell().offset(0, -2).activate();
spreadsheet.getActiveRangeList().setBorder(null, null, null, true, null, null, '#000000', SpreadsheetApp.BorderStyle.SOLID);
spreadsheet.getCurrentCell().offset(5, 0).activate();
};