How To Extract Url From Hyperlink In Google Sheets

When working with hyperlinks in Google Sheets, it’s not uncommon to need to extract the underlying URL from the displayed text. This can be a crucial step in data analysis, automation, and even data visualization. Having the ability to extract URLs from hyperlinks can open up a world of possibilities, from tracking website metrics to creating custom dashboards.

Overview

In this tutorial, we will explore the different methods to extract URLs from hyperlinks in Google Sheets. We will cover the use of formulas, functions, and even scripts to achieve this task. Whether you’re a beginner or an advanced user, this guide will provide you with the necessary tools and knowledge to extract URLs with ease.

What You Will Learn

By the end of this tutorial, you will be able to:

  • Use the HYPERLINK function to extract URLs
  • Employ the REGEXEXTRACT function to extract URLs from text
  • Utilize Google Apps Script to extract URLs from hyperlinks
  • Apply these methods to real-world scenarios and applications

So, let’s dive in and explore the different methods to extract URLs from hyperlinks in Google Sheets! (See Also: How To Do A Budget On Google Sheets)

How to Extract URL from Hyperlink in Google Sheets

When working with hyperlinks in Google Sheets, you may need to extract the underlying URL from the link text. This can be useful for various purposes, such as tracking website analytics, creating custom links, or simply organizing your data. In this article, we will explore the different methods to extract URL from hyperlink in Google Sheets.

Method 1: Using the FORMULATEXT Function

The FORMULATEXT function is a built-in Google Sheets function that returns the formula as a text string. We can use this function to extract the URL from a hyperlink. Here’s how:

  • Assuming the hyperlink is in cell A1, enter the formula: =FORMULATEXT(A1)
  • Press Enter to apply the formula
  • The formula will return the entire formula as a text string, including the URL
  • Use the FIND and LEN functions to extract the URL from the text string
  • The final formula would be: =MID(FORMULATEXT(A1),FIND(“http”,FORMULATEXT(A1)),LEN(FORMULATEXT(A1))-FIND(“http”,FORMULATEXT(A1))+1)

This method works well for simple hyperlinks, but it may not work for more complex links or those with multiple URLs.

Method 2: Using Regular Expressions

Regular expressions (regex) are a powerful tool for extracting patterns from text strings. We can use regex to extract the URL from a hyperlink in Google Sheets. Here’s how: (See Also: How To Merge First And Last Name In Google Sheets)

  • Assuming the hyperlink is in cell A1, enter the formula: =REGEXEXTRACT(A1,”https?://[^s]+”)
  • Press Enter to apply the formula
  • The formula will return the URL from the hyperlink
  • This method is more flexible and can handle complex links and multiple URLs

Regular expressions can be intimidating, but they offer a high degree of customization and flexibility.

Method 3: Using a Script

If you’re comfortable with Google Apps Script, you can create a custom function to extract the URL from a hyperlink. Here’s an example script:

function extractUrl(hyperlink) {
var url = hyperlink.toString().replace(“=HYPERLINK(“”

Leave a Comment