How to Use Hyperlinks in Google Sheets

This guide explains how you can easily create and manage hyperlinks in Google Sheets. An entire cell in the sheet, or specific text inside the cell, can be linked to external web pages. A cell can also contain multiple hyperlinks.

If you type a web page address in a Google Sheet cell, it is automatically converted into a clickable hyperlink.

Text converted into hyperlink

You can add anchor text to plain hyperlinks for more accessible URLs. Hover your mouse over the hyperlink and click the Edit icon. Now add the anchor text in the Text input box and click the green Apply button.

Alternatively, you may use the built-in HYPERLINK function in Google Sheet to create web links with (optional) anchor text.

 =HYPERLINK("https://www.labnol.org", "Digital Inspiration")

Add anchor text to hyperlink

It is also possible to include multiple hyperlinks inside a single cell of the Google Sheet.

Just type any text, include URLs in plain text and when you move the cursor out of the cell, the URLs are converted into hyperlinks.

Bonus Tip: While a cell with multiple links is selected, press Alt+Enter and all the links with open at once in new tabs.

Multiple hyperlinks in Google Sheet Cell

You can use the previous technique to edit multiple hyperlinks contained in a single cell and add anchor text.

Hover your mouse over a link in the cell, click the edit icon and change the Anchor text. Repeat this for all other links in the same cell.

Format Multiple URLs

Also see Secret Google Drive URLs.

Here are some snippets that will help you manage your hyperlinks in Google Sheets using Google Script macros.

const createHyperLinkWithFormula = () => {
  const link = 'https://www.labnol.org';
  const text = 'Digital Inspiration';
  const value = `=HYPERLINK("${link}", "${text}")`;
  const sheet = SpreadsheetApp.getActiveSheet();
  const range = sheet.getRange('A1');
  range.setValue(value);
};
const createHyperLinkWithRichTextValue = () => {
  const link = 'https://www.labnol.org';
  const text = 'Digital Inspiration';
  const value = SpreadsheetApp.newRichTextValue().setText(text).setLinkUrl(link).build();
  SpreadsheetApp.getActiveSheet().getRange('A1').setRichTextValue(value);
};
const createMultipleHyperLinks = () => {
  const value = SpreadsheetApp.newRichTextValue()
    .setText('Google acquired YouTube in 2006')
    .setLinkUrl(0, 6, 'https://www.google.com')
    .setLinkUrl(16, 23, 'https://www.youtube.com')
    .build();
  SpreadsheetApp.getActiveSheet().getRange('A1').setRichTextValue(value);
};
const extractLinkFromFormula = () => {
  const sheet = SpreadsheetApp.getActiveSheet();
  const range = sheet.getRange('A1');
  const formula = range.getFormula();
  const [, url, , text] = formula.match(/=HYPERLINK\("(.+?)"([;,]"(.+?)")?\)/) || [];
  Logger.log({ url, text: text || url });
};
const extractMultipleLinks = () => {
  const urls = SpreadsheetApp.getActiveSheet()
    .getRange('A1')
    .getRichTextValue()
    .getRuns()
    .map((run) => {
      return {
        url: run.getLinkUrl(),
        text: run.getText(),
      };
    })
    .filter(({ url }) => url);
  Logger.log(urls);
};

Also see: Extract Hyperlinks in Google Sheets

Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

0

Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.