4 Ways to Adjust Row Heights in Google Sheets

Video google sheet auto fit row height

Are you struggling to fit all your data into Google Sheets cells? With a default size for all cells, it’s often necessary to adjust the row heights or column widths to accommodate your data. But don’t worry, we’ve got you covered! In this article, you’ll discover four ways to adjust row heights in Google Sheets, whether you prefer using the mouse, the right-click menu, or even Google Apps Scripts.

Adjust Row Heights with the Mouse

Imagine having a range of cells with extra-large font data. The content is barely visible because the cells aren’t tall enough to display all the characters. But don’t fret, here’s how you can make the content more easily visible:

  1. Hover your mouse over the border between the selected row and the next row.
  2. Once you see a thick blue line and a double-headed arrow, click and hold the left mouse button.
  3. Drag the line downwards to increase the row height.
  4. Repeat this process for all rows until the content becomes visible.

By following these steps, you can enlarge the rows and make it easier to view their content. However, keep in mind that this method requires manually adjusting each cell’s height, which can result in inconsistent row heights and messy data.

Automatically Adjust Row Heights with a Double-Click

If you’re looking for a more efficient solution, the double-click method is for you. Just double-click on the row after getting the blue line across the sheet, and it will automatically adjust to the size of the characters. Remember, you’ll need to do this for each row individually to ensure they adjust automatically.

So far, these methods have allowed you to modify row heights individually. But what about changing the height of multiple cells at once? Let’s explore the next methods.

Adjust Row Heights to Fit Content Using the Right-Click Menu

To adjust row heights using the right-click menu, follow these steps:

  1. Click on the row number for the cell you want to resize. Make sure you select the row number, not the cell, to access the “Resize row” option.
  2. Right-click on the selected row number and choose the “Resize row” option.
  3. A “Resize row 1” dialog box will appear since you want to resize row one.
  4. In the dialog box, you have two options:
    • “Specify row height” allows you to set a specific height in pixels. The default is 21 pixels, but you can use a larger number based on your font size.
    • “Fit to data” automatically adjusts the row height to match the cell’s content. This option works just like the double-click automatic adjustment.

By using the right-click menu, you can conveniently adjust row heights. To resize multiple rows simultaneously, select the rows you want to adjust, right-click, and choose the “Resize rows” option.

Modify Row Heights with Google Apps Scripts

Google Apps Scripts is a powerful tool for automating tasks, including resizing row heights. You can write a script to automatically adjust rows or set them to specific pixel heights. Just copy and paste the following code into your Apps Script window, click “Save” and “Run”.

function onOpen(e) {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('Resize Rows')
    .addItem('Automatically adjust row height', 'FitRowstoData')
    .addItem('Row height in pixels', 'ResizeRowsto40pixels')
    .addToUi();
}

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

function ResizeRowsto40pixels() {
  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);
};

Once you run this code and refresh your spreadsheet document, a custom menu named “Resize Rows” will appear in your menu bar. You’ll find two options under this menu:

  • “Automatically adjust row height” adjusts rows based on their content.
  • “Row height in pixels” sets the row height to 40 pixels.

Feel free to modify the height in the “setRowHeights” section of the code by changing the third parameter, “40”, to your desired pixel height.

Conclusion

There are many reasons why you might need to adjust row heights in your Google Sheets. Whether you choose the quick fixes of click-and-drag or double-click, or prefer the efficiency of the right-click menu or Google Apps Scripts, you have all the tools you need!

Have you tried any of these techniques to modify row heights? Do you know of any other methods for resizing row heights? Share your thoughts in the comments below!

Crawlan.com

Related posts