Extracting links from hyperlinks in Google Sheets can be a tedious task, especially when dealing with a large dataset. However, with the right techniques and formulas, you can easily extract links from hyperlinks in Google Sheets.
Why Extract Links from Hyperlinks?
Extracting links from hyperlinks can be useful in various situations, such as:
- Cleaning up data by removing unnecessary formatting
- Converting hyperlinks to plain text for easier analysis
- Extracting URLs for further processing or analysis
- Creating a list of links for reference or sharing
Method 1: Using the =HYPERLINK
Function
Google Sheets provides a built-in function called =HYPERLINK
that can help you extract links from hyperlinks. Here's how to use it:

Assuming you have a hyperlink in cell A1, you can use the following formula to extract the link:
=HYPERLINK(A1)
This will return the URL of the hyperlink in cell A1.
Method 2: Using the =REGEXEXTRACT
Function
Another way to extract links from hyperlinks is by using the =REGEXEXTRACT
function, which is a part of Google Sheets' regular expression functions. Here's how to use it:

Assuming you have a hyperlink in cell A1, you can use the following formula to extract the link:
=REGEXEXTRACT(A1,"https?://[^&]+")
This formula uses a regular expression to match the URL pattern in the hyperlink.
Method 3: Using a Script
If you need to extract links from multiple cells or a large dataset, you can use a script to automate the process. Here's an example script:
function extractLinks() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("A1:A10"); // adjust the range to your needs
var values = range.getValues();
for (var i = 0; i < values.length; i++) {
var cellValue = values[i][0];
var link = cellValue.toString().match(/https?:\/\/[^&]+/);
if (link) {
sheet.getRange(i + 1, 2).setValue(link[0]); // output the link in column B
}
}
}
To use this script, follow these steps:
- Open your Google Sheet.
- Click on "Tools" in the menu.
- Click on "Script editor".
- Delete any existing code in the editor.
- Paste the script above into the editor.
- Save the script.
- Run the script by clicking on the "Run" button or pressing Ctrl+Enter.
Tips and Variations
- To extract links from multiple cells, you can adjust the range in the script or use an array formula with the
=HYPERLINK
or=REGEXEXTRACT
function. - To extract links from a specific column, you can modify the script to iterate over the column range instead of the entire range.
- To extract links from a specific sheet, you can modify the script to specify the sheet name or ID.
Google Sheets Image Gallery










Conclusion
Extracting links from hyperlinks in Google Sheets can be a simple task with the right techniques and formulas. Whether you use the =HYPERLINK
function, the =REGEXEXTRACT
function, or a script, you can easily extract links from hyperlinks and use them for further analysis or processing.