I'm going to be honest; my biggest issue is describing what I wish to accomplish. I can't find the right word for it, so the title might not make a lot of sense. But the pictures should be clear,

I want to take this sheet:


Perform some operation, and end up with this:


Currently this takes a lot of effort, particularly for large amounts of values. I first have to move each row down to get white rows between each row with values, and then merge them individually. Takes a lot of clicks, and I do this semi-regularly. If there is an extension that does this, or a way to do this less laboriously, I would be very happy.

1 Answer 1


You can use the following Google Apps Script function to do it:

function mergeFunction() {
  const spreadsheet = SpreadsheetApp.getActive();
  const range = spreadsheet.getActiveRange();
  let numRows = range.getNumRows();
  let extra = 0;
  let idx = 1;
  while(idx <= numRows) {
    spreadsheet.getActiveSheet().getRange(idx+extra, range.getColumn(), 2, 1).activate().mergeVertically();
    spreadsheet.getActiveRangeList().setVerticalAlignment('middle'); // not necessary if you don't care about cells being aligned vertically in the middle

You can use this function by selecting your range of values and executing the function. You can also bind the function to a macro to make it easier to execute.

This solution assumes you're only dealing with a data range consisting of 1 column

  • 1
    Why thank you! That script looks really intuitive too, so I can try playing around with it if different requirements surface.
    – KeizerHarm
    Jul 7, 2020 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.