I'd like to create a new row and then copy all the formulas from the row below to this new row (with relative references, just as if I dragged the formulas manually). My purpose is to copy only the formulas, not the values. I mean, if there is no formula, only a value in the cell below, then the cell above (in the new row) shall be empty. I can have something like this:
spreadsheet.getRange('F3').activate();
spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('F2:F3'), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
spreadsheet.getRange('H3').activate();
spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('H2:H3'), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
spreadsheet.getRange('L3').activate();
spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('L2:L3'), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
(As formulas are F3, H3 and L3.)
But there I have to change the code every time I change something in the sheet. So I would need something that directly gets and sets all the formulas but only the formulas. Tried to check getFormulas() and setFormulas() but don't understand how it works.