Reputation: 11
I have this script and work fine. But I have one question: How to add rows with an text instead of white?
function addRows(){
var startRow = 1;
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
for (var i=numRows; i > -1; i--) {
sheet.insertRowsAfter(i + startRow, 2);
}
}
Upvotes: 1
Views: 289
Reputation: 64062
Try this:
function addRows(){
var sheet=SpreadsheetApp.getActiveSheet();
var data=sheet.getDataRange().getValues();
var d=0;
data.forEach(function(r,i){
sheet.insertRowAfter(i+1+d++)
});
}
Animation:
Upvotes: 1