I am trying to duplicate a working script from Google Sheets into Excel. The goal is to copy the second row of the active sheet and paste the formatting, data validation and formulas into a new row above. This is intended to place a new (formatted with formulas and data validation) in row 2 below the headers.
Here's the google script
// global
var ss = SpreadsheetApp.getActive();
function addFirstRow() {
var firstRow = 2;
var sh = ss.getActiveSheet();
var lCol = sh.getLastColumn();
var range = sh.getRange(firstRow, 1, 1, lCol);
var formulas = range.getFormulas();
sh.insertRowsBefore(firstRow, 1);
var newRange = sh.getRange(firstRow, 1, 1, lCol);
newRange = sh.getRange(firstRow, 1, 1, lCol);
newRange.setFormulas(formulas);
}
Here's a video of the google sheets in action https://youtu.be/OCinWCApypw