Power Query Problems

Preserve Hyperlinks When Refreshing SQL Data in Excel Power Query

Chanuka GeekiyanageChanuka Geekiyanage Nov 12, 2026 871 views

Question details

Create hyperlinks that remain connected to the correct SQL query records after an Excel Power Query refresh.

Preserve Hyperlinks When Refreshing SQL Data in Excel Power Query
Product
Microsoft Excel Power Query with a SQL data source
Device & OS
not provided
Scenario
The user refreshes a SQL query table and needs each returned code or key to link to a related file, folder, or webpage.
Observed behavior
Manually inserted hyperlinks can be removed or become misaligned when the refresh adds, removes, or reorders rows.
Before you start

Make sure the SQL query returns a stable field, such as a code, ID, or file key, that can be used to construct each destination address. Identify the consistent URL or folder-path pattern and file extension before adding the formula.

Solution 1Recommended

Create a dynamic HYPERLINK formula beside the query table

Use this method when each SQL record has a code or key that can be combined with a fixed folder path, URL, or filename pattern.

A formula-based hyperlink is calculated from the current row's query result instead of being manually attached to a row. When Power Query refreshes the table, the formula can continue to generate the correct link for each returned record.

1
Locate the returned key column

In the Excel query output table, identify the column containing the code, ID, or filename component needed to create the link.

2
Add a hyperlink column next to the query output

Insert a column immediately to the right of the query table, then enter a header such as Link or Open File. Keeping the formula adjacent to the query output helps Excel maintain it with the refreshed rows.

3
Enter a HYPERLINK formula based on the current row

In the first data cell of the new column, enter a formula such as =HYPERLINK("\\Server\SharedFolder\"&[@Code]&".pdf","Open file"), replacing [@Code], the path, extension, and display text with your own values. For a web address, use a pattern such as =HYPERLINK("https://example.com/files/"&[@Code],"View record").

4
Fill the formula through the table column

Press Enter and allow Excel to fill the calculated column, or drag the fill handle if needed. Confirm that each link opens the destination associated with that row's returned code.

5
Refresh the query and verify the results

Select Data > Refresh All, then check newly added, moved, and retained rows. The hyperlink text should be regenerated from the refreshed row values.

Create a dynamic HYPERLINK formula beside the query table
Dynamic links stay row-based: Because each link is created from the row's current code or key, it can remain accurate when SQL refreshes change the order or number of records.
Free Microsoft Office alternative

Create Dynamic Hyperlinks in WPS Spreadsheet

If Excel Power Query refresh behavior is interrupting your workflow, WPS Office is a free, lightweight Office alternative with a familiar spreadsheet interface. You can open and edit compatible Excel workbooks, use HYPERLINK formulas to generate row-based links, and move existing spreadsheet work to WPS Office with minimal adjustment.

Use HYPERLINK formulas to create links from codes, IDs, paths, and URLs.Open, edit, and save Microsoft Excel .xlsx and .xls workbooks.Work in a lightweight spreadsheet app with familiar cells, formulas, tables, and menus.Maintain a portable link-building workflow when migrating compatible spreadsheet files.
microsoft office alternative - wps office

Frequently Asked Questions

Why do manually inserted hyperlinks disappear after an Excel query refresh?

A refresh can rebuild or resize the query output range, so hyperlinks manually attached to individual cells may not remain associated with the refreshed records. A formula using HYPERLINK is recalculated from the current row data instead.

Where should I put a HYPERLINK formula next to a Power Query table?

Add the formula in a column immediately to the right of the loaded query table. Use the table's current-row reference, such as [@Code], so the link is generated from the value in the same row.

Can I create hyperlinks from a network folder and a SQL code?

Yes. Combine the shared folder path, the returned code, and the extension in a formula, for example =HYPERLINK("\\Server\Folder\"&[@Code]&".pdf","Open file"). Ensure users have permission to access the shared folder.

Can Power Query return the full hyperlink address?

Yes. You can generate a URL or file-path column in SQL or in Power Query, then use an adjacent worksheet formula such as =HYPERLINK([@FilePath],"Open") to make it clickable.

Will dynamic hyperlinks handle new rows after refresh?

They can, provided the formula column remains next to the query table and uses the current row's key or destination field. After refresh, verify that Excel has extended the calculated formula to any newly returned rows.