Create links to the first item of each group in Google Sheets

Imagine you have a Google Sheet tab containing a course worth of hundreds of students sorted into classes or groups. After each exam, quiz or assignment, your teacher for each class needs to enter in the grades.

To make life easier for your teachers, we want to create a summary page where we can click on their class and be navigated directly to their group.

We don’t want to have to manually create a link for each location so we are going to write a formula to do the work for us.

Now, the formula is a little complex. So first off, we will generate our list of classes and add a separate section start link for each one. Then we will combine the two together to generate a single formula that gets all the unique sections and provides a link for each one.

If you are playing along, you can grab a copy of the starter sheet here:

STARTER SHEET

Continue reading “Create links to the first item of each group in Google Sheets”

Adding Links to Images and Buttons in Google Sheets

Have you ever tried to add a link or URL to an image in Google Sheets only to discover it is deleted and replaced by just the URL? It’s a pain.

In this tutorial, we will cover a few simple approaches to adding links to images in Google Sheets.

First, we will cover an approach using formulas and then we will use a sneaky approach using a bit of cell and image manipulation.

If you have come to this tutorial looking for a Google Apps Script solution, well… 1) I would discourage it, but 2) if you really must, check out the link to this tutorial for a hacky workaround.

On with the show!

The Formula Approach

In this example, we will use the IMAGE and HYPERLINK Google Sheets functions.

If you want to play along here is a link to the Starter Google Sheet:

Addling links to images in Google Sheets – Starter

(Select both the image and the Google Sheet, right-click and select ‘Make a copy’)

The basic pattern is as follows:

=HYPERLINK("URL - Link",IMAGE("URL to your image"))

Working from the inside out, the IMAGE function requires a link to the image that is being used. There are a number of ways of getting this link that I will cover in a  moment.

The HYPERLINK Google Sheets function takes the destination link as its first argument and then and then a link label as its second argument. Generally, this argument is text, but we can coerce this label into an image by replacing it with our IMAGE function.

But how do we get the image URL?

Image from an external website

If you store your images on a personal website or from some online photo hosting sites you can get the link to the image.

In the example below, I have a link from my website to my image. I want to use that image as my URL label. This is what my image link would look like:

=HYPERLINK("https://yagisanatode.com",IMAGE("https://yagisanatode.com/wp-content/uploads/2022/05/yagisanatodeSiteBanner_titleOnly-500-width.jpg"))

This will result in this image link:

Adding a link to an image in Google Sheets_image url is external
Click to Expand!

Image from Google Drive

Unfortunately, we can’t just go to Insert > Image > Insert image in cell for this. Nor can we go to our Google drive, select the image share it and get the URL from the share.

It won’t work.

There are a couple of workarounds for this, but probably the easiest approach is to open the image in a drawing.

Here is how we do it:

    1. Navigate to the Google Drive folder where your image is saved.
    2. In a blank space in the folder right-click > More… > Google Drawings

      Creating a Google Drawing File in Google Drive
      Click to Expand!
    3. Inside Google Drawings select Insert > Image > Drive.
      Insert an image into Google Drawings
    4. A sidebar will appear. Navigate to your image and double-click it. It will load into your drawing.
      Insert an image into Google Drawings select from drive
    5. Holding the left mouse button down, drag the image up to the top-left corner of the drawing.
    6. You will notice a checkered grey and white area in the background, this is the page area. We want the page area to be equal to the image. In the bottom right of the page area, there is a little move triangle-shaped button click and drag it up to match the size of the image.

      Resizing the Google Drawing page
      Click to expand
    7. In the top right of the Drawing app, rename it by clicking on the top-left text where it says “Untitled”. Make sure it is something meaningful for your task.
    8. Now we get the URL for the image. Select File > Share with others > Publish to the web. 
    9. A dialogue box will appear. Make sure Link is selected, choose your preferred size and then select Publish.
      Google Drawing Publish to the web as a link
    10. You will get an alert that comes down from the top of the page making sure you want to publish this image. Select Ok.
    11. You will now have a Google Drawing URL. Hit Ctrl + C  (⌘ + C) to copy it.
    12. Head back to your Google Sheet and insert it into IMAGE function. It should look similar to this:

=HYPERLINK("https://yagisanatode.com",IMAGE("https://docs.google.com/drawings/d/e/2PACX-1vR2MqTAC_SBvvoWlAwLL_Pk5gHbLzOb0CJAOvbxitdNvstsX477fX8xRqvvQDOohuF83Ie4UQS4AQvk/pub?w=502&h=503"))

Adding a link to an image in Google Sheets_Google Drawing URL

You can also do the same thing with custom drawings and buttons using Google Drawing. Check out the video below for a demonstration of this.

If you have found the tutorial helpful, why not shout me a coffee ☕? I'd really appreciate it.

The video

The sneaky approach to adding  Links to images.

Another approach to adding links to images in Google Sheets that you may want to consider is to add a URL to a cell that you want to use for your image and then insert an image over cells. Then move that image so that it fits inside the cell with the URL.

When a user clicks or hovers over the cell and image the link will appear.

Here are the detailed steps:

  1. Select a cell. If you want something larger, you may have to merge cells together to make it just right.
  2. Add your URL to the selected cell.
  3. Change the text colour of the cell to match the background colour. This will hide the URL just in case you didn’t fit your image in perfectly.
    Adding a link to a cell in google sheets
  4. Now go to Insert > Image > Insert image in cell
    Insert image over cells in Google Sheets
  5. Select your image from your desired location.
  6. One the image appears in the Sheet, move the image to the cell with the link and resize it so that it fits just inside the cell. Note! You should leave a tiny bit of space from the edges of the cell so that the URL is picked up.

The end result should look a little like this:

Sneaky image with URL in Google Sheets

That’s all there is to it.

The Video

Did you enjoy the tutorial? Want to upskill and get a solid step-by-step course to become a pro at Google Sheets? Check out my course, Google Sheets: Learn the Essentials with Three Detailed Projects. Sign up today.

 
Google Sheets Shortcuts Mousepad
Google Sheets Shortcuts Mousepad
Want a fast track to boost your Spreadsheet efficiency? Grab one of these handy Google Sheets Shortcuts mousepads that I created from my store.
Google Sheets Shortcuts Mousepad Gel
Google Sheets Shortcuts Mousepad Ge

~Yagi