How do I insert empty rows under all (already occupied) rows simultaneously in Google Spreadsheets?
Lets say in row 1 it says "A" and in row 2 it says "B", "C" in row 3, etc. I would like it to say "B" in row 3, and "C" in row 5, etc. from now on. Inserting a row underneath one by one is simple. I'm asking about inserting empty rows on a larger scale.
Best Answer
I think this requires a script, such as this one:
The command
getDataRange()
selects the range containing data; but since it's possible you have empty rows between filled ones, there is a separate check for nonemptiness of rows:values[i-1].join("")
evaluates to True only if some data is present. The offseti-1
is needed because the index in an array is 0-based, while the row numbers begin with 1. I usei
for row number.The rows are inserted from bottom up (
i--
), to avoid the situation where newly added rows move down the ones that are still to be processed.To use this: