Google Sheets – Grouping rows and columns

Grouping and ungrouping columns

Sometimes we have large spreadsheets where we want to work with only certain rows or columns. Sheets gives the option to group rows or columns, allowing you with one click to show and hide numerous rows and columns, rather than having to go into the menus and hide the ones you want.

As an example, we have a list of classes, which contains key dates for when the exams, reports, and certificates have to be done or handed out. It’s divided into 3 terms, and the administrator sometimes wants to work with the data for the whole year but also sometimes only for a specific term.

So, what we can do is group the columns for each term together.

First, highlight the columns you want to group by highlighting the tops of the columns. In this case they are columns B to D.

Right click on the selected columns, and select “Group columns B – D” from there.

You’ll see a line with a little box with a minus sign in it. This shows the columns which are grouped and also that the columns are visible. Note, the column with the box in it (column A), isn’t part of the grouped columns.

To hide the group of columns, just click on the little box. This will hide the grouped columns and the box will change to a plus sign, to show the columns are hidden. To view the columns again, just click on the plus sign.

We can set up more than one group of columns. Here, I’ve set up three, one for each term.

Note, I’ve added empty columns in column E and I. The reason for this is that you can’t have groups of columns that are next to each other. In other words, you can’t have a group for columns B to D and then another from E to G, as D and E are next to each other and it just combines the two into one large group B to G. To get around that, I add a spacer column as you can see in column E.

Grouping and ungrouping rows

We can also group rows in a similar way. Select the rows you want by highlighting the rows. Here, I have two types of classes, A and B, and I want to group the B classes to be able to work just with the A ones.

Right-click and select “Group rows 8 – 12”.

As before, this shows which rows are grouped and shows that the rows are currently visible.

Click on the minus sign to hide the group of rows.

We can change which rows are grouped. If you want to remove a row or column, just highlight it and right-click. Then, select “Ungroup row” (or column).

You can see that row 12 is now not part of the group.

We can also do the same for multiple rows. For example, if you want to remove the grouping, just highlight the rows or columns.

Right-click and select “Ungroup rows 8 – 12” (or columns).


This post is taken from my book “Beginner’s Guide to Google Sheets“, available on Amazon here.

Want to learn more about Google Workspace and Apps Script? The books below are available on Amazon. Just click on a book! (Affiliate links).

JavaScript Fundamentals for Apps Script users

a

Google Apps Script Projects 1
Google Apps Script Projects 2