2

Say I have a sheet with values in all visible cells. I want to insert cells above, say, C3:D3 so that the existing values in C3:D3 and below are moved downwards. I want the columns next to C3:D3 to remain unchanged. Is this at all possible?

Thank you.

Nagaram92
  • 153
  • 2
  • 10

1 Answers1

3

Possible. You'd use insertCells():

function testInsertCells(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  var range = sheet.getRange("C3:D3");
  range.insertCells(SpreadsheetApp.Dimension.ROWS);
}
TheMaster
  • 45,448
  • 6
  • 62
  • 85