How to insert a new row in SpreadSheets?

So I’m trying to insert a new row that exists in the context menu.

There’s my code

var oWorksheet = Api.GetActiveSheet();
const ActiveCell = oWorksheet.GetActiveCell();
ActiveCell.Insert('down');

but it only adds a new single cell

For someone coming here with the same question I didn’t find a specific method, I’m doing like this (probably not the best solution):

const usedRange = oWorksheet.GetUsedRange();
      const cols = usedRange.GetCols();
      for (let i = 0; i < cols.Value[0].length; i++) {
        console.log({ i, value: cols.Value[0][i] });
        const rowRange = oWorksheet.GetRangeByNumber(activeCellRow, i);
        rowRange.Insert('down');
      }

Hello @Cursed

Unfortunately, there is no direct method for that as you noticed correctly. However, you can also use GetRows and Insert methods for this like that:

var oWorksheet = Api.GetActiveSheet();
var oRange = oWorksheet.GetRange("1:1");
for (let i=1; i <= 1; i++) {
    var oRows = oRange.GetRows(i);    
    oRows.Insert("down");
}

Here, GetRange("1:1") specifies range above which new empty row will be inserted and i <= 1 amount of new rows. To my mind this example is quite easier to use because GetRange selects entire row for that matter.