Extract URLs from Hyperlinked Text in Google Sheets (Formulas vs Faster Workflow)

Compare REGEXEXTRACT formulas and Apps Script with a faster copy-and-paste workflow using URL Extractor to pull URLs out of hyperlinked text in Google Sheets.

11/19/2025

Extract URLs from Hyperlinked Text in Google Sheets (Formulas vs Faster Workflow)


Google Sheets users have been trying to answer the same question for years:


> *"How do I extract the URL from hyperlinked text?"*


If you have cells where the text is something like:


  • `4 - Energy, Work and Power - AP Physics1`

  • but the actual URL is hidden behind Command + K or a right‑click “Insert link…”, a simple formula often does not work.


    This guide walks through:


  • The classic formula approach with `REGEXEXTRACT` and why it breaks.
  • A script‑based workaround that reads rich‑text link URLs.
  • A faster, one‑time workflow that uses URL Extractor instead of formulas.

  • ---


    Quick steps


  • Use formulas only when you need a dynamic, always‑up‑to‑date URL column.
  • For one‑time exports, copy the hyperlinked cells and paste them into URL Extractor.
  • Click GET URL to build a flat list of every link.
  • Clean the list, then Copy All or Open All depending on your task.
  • Keep the copy‑and‑paste workflow as your default, and fall back to formulas or scripts only when needed.

  • ---


    1. The classic REGEXEXTRACT formula


    One common answer online suggests using `FORMULATEXT` and `REGEXEXTRACT` together.


    The idea looks like this:


  • Put a hyperlink formula in `A1), for example:
  • `=HYPERLINK("https://example.com", "Example")`

  • In `B1`, use a formula to pull out the URL:

  • `=REGEXEXTRACT(FORMULATEXT(A1), """(http[s]?://[^""]+)""")`


    What this does:


  • `FORMULATEXT(A1)` returns the literal text of the formula in `A1), including the URL.
  • `REGEXEXTRACT` then searches that text for a pattern that looks like a URL.

  • On paper, this seems like a neat trick. In practice, there are several problems.


    Problem 1 – It only works on cells with formulas


    The approach above assumes that the hyperlink was created with a formula such as `HYPERLINK("https://...", "Label")`.


    Many modern sheets are not built this way. Instead, users:


  • Type a label like “Chapter 4 – Energy, Work and Power”.
  • Press `Cmd + K` / `Ctrl + K`.
  • Paste the URL into the link dialog.

  • This creates rich‑text formatting with a link behind it, not a formula.


    When you run `FORMULATEXT` on a cell like that, it does not return a formula string with a URL. Depending on the cell, you may see:


  • The plain text `"Chapter 4 – Energy, Work and Power"`.
  • An error such as “Invalid formula parse result.”

  • There is nothing for `REGEXEXTRACT` to find, so the URL never appears.


    Problem 2 – Slight changes break the regex


    Even when a hyperlink is formula‑based, small variations can break the regular expression:


  • Additional parameters.
  • Line breaks.
  • Different quoting styles.

  • You may see variants online such as:


  • `=REGEXEXTRACT(FORMULATEXT(B5),"""(.+?)""")`

  • These can work in narrow cases but still fail when the sheet layout changes. Maintaining a delicate regex for URLs inside formula text quickly becomes fragile.


    ---


    2. A script‑based workaround for rich‑text hyperlinks


    Some answers go further and suggest using Google Apps Script. The idea is:


  • Let a custom function read the cell’s rich‑text formatting.
  • Return the underlying link URL instead of the visible label.

  • A simplified example looks like this:


  • In Apps Script, add a function:

  • `

    function EXTRACTHYPERLINK(input) {

    const sheet = SpreadsheetApp.getActiveSheet();

    const range = sheet.getRange(input);

    const values = range.getRichTextValues();

    return values.map(row =>

    row.map(cell => cell.getLinkUrl())

    );

    }

    `


  • In your sheet, call it like:

  • `=EXTRACTHYPERLINK("A2")`


    This reads the rich‑text values from the referenced range and returns the link URLs.


    It solves the “Command + K” problem, but it also introduces new trade‑offs:


  • You must maintain a script attached to the spreadsheet.
  • The behavior is less transparent to collaborators who are not familiar with Apps Script.
  • It is better suited to power users than to occasional spreadsheet work.

  • For a deeper dive into this style of solution, there are blog posts that explore extracting link URLs from rich‑text cells in detail. One example is a guide on “extracting URLs from hyperlinks in Google Sheets” that walks through the Apps Script approach step by step.


    ---


    3. A faster workflow when you only need a list once


    In many real‑world cases, you do not need a permanent formula or script. You simply want a clean list of URLs so that you can:


  • Paste them into another system.
  • Review them for quality or broken links.
  • Share them as a reference list.

  • Instead of fighting with formulas, you can treat URL Extractor as a side‑tool next to Google Sheets.


    Step 1 – Select and copy the cells with hyperlinks


  • In Google Sheets, select the column or range that contains your hyperlinked labels.
  • Use `Ctrl + C` / `Cmd + C` to copy them.
  • Do not choose “Copy as plain text” or export to CSV, because those routes strip hyperlink information.

  • Sheets usually places both plain text and HTML into your clipboard. URL Extractor uses the HTML part where it can.


    Step 2 – Paste into URL Extractor


  • Open URL Extractor in your browser.
  • Click inside the “Paste Your Content” area.
  • Press `Ctrl + V` / `Cmd + V` to paste.
  • Look for helper text indicating that hyperlinks were detected.

  • If your clipboard preserved rich text, URL Extractor can see the underlying `href` values even when Sheets only shows labels.


    Step 3 – Convert plain‑text URLs if needed


    If the sheet only contains raw URLs with no hyperlink formatting:


  • After pasting, click Convert URLs to Links.
  • URL Extractor will scan the text and wrap each detected URL in an anchor tag.

  • This step makes the later extraction more consistent, regardless of how the sheet was originally formatted.


    Step 4 – Click **GET URL** to build the list


  • With the content in place, click the yellow GET URL button.
  • The tool parses the HTML and produces a flat list of URLs and their labels.

  • Instead of scanning cell by cell, you now see every link in one structured list.


    Step 5 – Clean, copy, or open the links


    Use the list as a small workspace:


  • Delete entries that are clearly out of scope.
  • Adjust labels so they remain clear outside the original sheet.
  • Use Copy All to move the URLs into another document or spreadsheet.
  • Use Open All when you want to quickly check that links still work.

  • When you are finished, click Clear and repeat the same steps for the next batch of cells.


    ---


    4. When to choose formulas, scripts, or URL Extractor


    Different methods make sense in different situations:


  • Use formulas (such as `REGEXEXTRACT` on `HYPERLINK` formulas) when:
  • - Every link is created with a formula.

    - You want a URL column that updates automatically as formulas change.


  • Use an Apps Script helper (such as a function that calls `getRichTextValues()`) when:
  • - Many cells use Command + K or rich‑text links.

    - You are comfortable maintaining script code in the spreadsheet.

    - Other collaborators understand what the custom function does.


  • Use URL Extractor when:
  • - You just need a one‑time export of URLs from a sheet.

    - Links are scattered across different ranges, tabs, or formats.

    - You want to review, clean, and act on links in bulk without writing formulas or scripts.


    You can also mix these approaches. For example, use URL Extractor to explore what links exist, then later add a formula‑based column for the subset of data that needs to stay dynamic.


    ---


    Related articles


  • How to Extract URLs from Google Sheets
  • Best Mass URL Extractor: Bulk URL Extractor for Web Links

  • URL Extractor