Data Import & Export

Keep Hyperlinks When Importing Web Data Into Excel

Algirdas JasaitisAlgirdas Jasaitis Nov 20, 2026 869 views

Question details

Import web page data into Excel while retaining links to documents such as PDFs.

How to Keep Hyperlinks When Importing Web Data Into Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user imports a web page through Data > From Web and wants to keep its document links.
Observed behavior
The import may return the visible page text without the underlying hyperlink URLs.
Before you start

Copy the address of the page containing the links and confirm that you can open it in a browser. Power Query must be able to access the page HTML; links added by scripts or protected by sign-in may require another approach.

Solution 1Recommended

Extract hyperlink URLs with Excel Power Query

Use this method when the page HTML contains the links you want to import.

A standard From Web table import may keep visible text but omit link addresses. This query reads anchor elements and extracts their text and href attributes instead.

1
Create a blank query

In Excel, select Data > Get Data > From Other Sources > Blank Query.

2
Enter the extraction query

In Power Query Editor, select Home > Advanced Editor. Replace the existing code with the following, change the example address to the page URL, and select Done: let pageUrl = "https://example.com/documents/", Links = Html.Table(Web.Contents(pageUrl), {{"Link text", "a", each [Text]}, {"URL", "a", each try Uri.Combine(pageUrl, [Attributes][href]) otherwise null}}) in Links

3
Load the links

Review the Link text and URL columns in the preview, then select Home > Close & Load. Filter the URL column for .pdf if you only need PDF links.

4
Make the links clickable

If link text is in A2 and its URL is in B2, enter =IF(B2="","",HYPERLINK(B2,A2)) in an empty column and fill the formula down.

Extract hyperlink URLs with Excel Power Query
Page access limitations: The query extracts links present in the HTML returned to Power Query. It may not find links generated by page scripts or accessible only after authentication.
Free Microsoft Office alternative

Work With Document Links in WPS Spreadsheets

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Excel format compatibility for an easy transition. In WPS Spreadsheets, you can organize separately collected URLs and create clickable labels with HYPERLINK; it does not fix Excel's From Web import.

Create clickable document links from labels and URLs with HYPERLINKOpen and save Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interface to ease migrationWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why did Excel import the page text without the PDF links?

Data > From Web may import a table's visible text without its underlying hyperlink attributes. Use Power Query to extract the anchor href values or copy the URLs separately.

Can I extract only PDF links from the page?

After loading the link text and URL columns, use the URL column's filter to find addresses containing .pdf. Some PDF links may use addresses without that extension, so check the results against the source page.

How do I turn an imported URL into a clickable link?

If the URL is in B2 and its label is in A2, enter =HYPERLINK(B2,A2) in another cell, then fill the formula down.

Why does the Power Query result have missing links?

The links may be generated by scripts, require sign-in, or be absent from the HTML returned to Power Query. Check the page in a browser and copy the link addresses manually if necessary.