Keep Hyperlinks When Importing Web Data Into Excel
Question details
Import web page data into Excel while retaining links to documents such as PDFs.

- 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.
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.
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.
In Excel, select Data > Get Data > From Other Sources > Blank 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
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.
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.

Add hyperlinks from separately copied URLs
Use this approach for a small number of links or when Power Query cannot extract them.
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.

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.




