4 Ways to Change Row Height in Google Sheets

Cells in a Google Sheet can contain a lot of data, up to 50,000 characters! That’s over 15 pages of a single-spaced word document!

Fitting all that data means you might need to change the row height or columns width to fit all your data.

As you enter data in a cell, it will spill across to other cells and make the sheet look very messy. For some reason, the cells don’t increase in size as the number of characters increase.

By default, all the cells in a spreadsheet have the same size and they don’t resize themselves to fit the all characters inside them. You will have to resize the cells to fit your data.

In this post, you will see how to change the row height of your cells in Google sheets. Asides from the Apps Script code, you can use these methods for changing the column width of cells as well.

Get your copy of the workbook to follow along!

Change the Row Height with the Mouse

In this example, there is a range of cells with data in extra-large fonts. The contents of the cells can barely be seen because the cells don’t fit the size of the characters.

To increase the row height of the cells with the mouse so their contents will become easier to view, follow these procedures.

Hover the mouse on the border between the selected row the row that comes after it.

If you do this right, the border between the rows will show a thick blue line, and the mouse’s arrow will change to a double-headed arrow as depicted in the image above.

When the double-headed arrow appears, click on the left button of your mouse and hold it. The double-headed arrow will disappear, and a blue line that goes across to the opposite end of the sheet will surface. Drag this line down to expand the height of the row.

Do this on all the rows until their contents become visible.

The rows have been expanded and it’s much easier to see their contents. But obviously, some improvements can still be made.

Using this method requires that you approximate what the right row height will be for each cell since you have to resize them individually. That can result in the rows having dissimilar heights, making the dataset look disorganized.

The disadvantage of this method brings us to the next method for changing row height.

Auto-fit Row Height with Double Click

The double-click solution is an upgrade to the click and drag method.

With this method, when you get the blue line that goes across to the opposite end of the sheet, all you need to do is double-click.

When you double-click on the row, it will auto-fit to the size of the characters and appear properly sized. You will need to do this for each row to get them auto-fitted.

So far, these methods make you alter the heights of rows individually. The following methods will help you change the row height of multiple cells at once.

Fit Row Height to Size with Right-Click Menu

To use the right-click menu, follow these steps.

Click on the row number of the cell you want to resize. It’s important to emphasize that you must select the row number and not the cell if you want to use the right-click menu to resize row height. If you don’t select row number, you will not get the option to resize row height when you right-click.

Right-click on the selected row number and select the Resize the row option.

After selecting the Resize the row option, you will get a Resize row 1 dialogue box because you want to resize row one.

In the dialogue box, you can select from two resizing options.

The first option to Specify row height provides an editor window where you can give a specific row height in pixels. The default number of pixels is 21. Depending on your font size, you can use a number higher than 21.

The second option to Fit to data will auto-fit your row height to the size of the cell contents. This option works exactly like the auto-fit option from double-clicking.

Using the Specify row height option, set your row height to 40 pixels and click on okay.

Row 1 is now resized appropriately.

To resize multiple row heights at once, select all the rows you want to resize. You can do this in multiple ways, but the most efficient way to do it will be to select the first row to resize, hold the Shift key and select the last row you want to resize.

This will select all the rows in between.

The row numbers on the left will be highlighted in grey when you have them selected.

When you have the rows selected, you can then right-click and choose the Resize rows option from the menu as earlier described.

Change the Row Height in Google Apps Scripts

Google Apps Scripts is a powerful tool for automating any task and you can use it to resize row height too.

You write a script to autofit rows or set rows to a specific height using pixels. Copy and paste the code below on your Apps Script window. Click Save and Run it.

function onOpen(e) {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('Resize Row')
      .addItem('AutoFit Row Height', 'Fitrowtodata')
      .addItem('Pixel Row Heigth', 'ResizeRowto40pixels')
      .addToUi();
}

function Fitrowtodata() {
  var spreadsheet = SpreadsheetApp.getActive();
  var sheet = spreadsheet.getActiveSheet();
  sheet.getRange(spreadsheet.getCurrentCell().getRow(), 1, 5, sheet.getMaxColumns()).activate();
  spreadsheet.getActiveSheet().autoResizeRows(1, 5);
};

function ResizeRowto40pixels() {
  var spreadsheet = SpreadsheetApp.getActive();
  var sheet = spreadsheet.getActiveSheet();
  sheet.getRange(spreadsheet.getCurrentCell().getRow() - 6, 1, 5, sheet.getMaxColumns()).activate();
  spreadsheet.getActiveSheet().setRowHeights(1, 5, 40);
};

When you run this code and refresh your spreadsheet document, a custom menu, Resize Row, will be created in your menu bar.

  1. Use the AutoFit Row menu to fit rows to the data
  2. Use the Row Pixel to fit set rows to 40-pixel height.

If you want to change the row height in the setRowHeights section. You can change the third parameter 40 to alter the pixel height of the rows.

Conclusions

There are many reasons you will need to change row height in your spreadsheet.

The click and drag and double-click options for changing row height are quick fixes when changing the size of a few rows.

For resizing the heights of a dataset with lots of rows, using the Right-click menu or an Apps Script will be a more efficient option as you will be able to resize multiple rows at the same time.

Do you use any of these techniques for changing the row height? Do you know other ways to resize row heights? Let me know in the comments section below!

About the Author

Oluwaseun Olatoye

Oluwaseun Olatoye

Oluwaseun is a business intelligence analyst with expertise in Google Sheets and SQL programming language. He has worked with various businesses to make data-driven decisions. He enjoys helping others learn and grow.

Related Articles

Comments

0 Comments

Get the Latest Google Sheets Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in Google Sheets!