logo
search
Data Import & Export

How to Create Excel Links to Local Files Using File URIs

Maira MehtabMaira Mehtab Oct 13, 2026 871 views

Question details

The user wants to import a file list generated by the Windows DIR command into Excel and convert the text entries into clickable links that open local files or folders.

How to Create Excel Links to Local Files Using File URIs
Product
Excel
Device & OS
Windows
Scenario
Importing a directory text list into a spreadsheet and turning the file names into active file URI hyperlinks.
Observed behavior
The user requires a systematic method to batch convert plain text file names into active links that open directly in Windows File Explorer.
Before you start

Ensure you know the exact folder path of your local files and verify that your system or organizational security policies permit opening local or network files directly from a spreadsheet.

Solution 1Recommended

Import Directory List and Apply the HYPERLINK Function

Use the Windows Command Prompt to generate a text file of your directory contents, import it, and apply Excel's HYPERLINK function to create clickable local links.

This method is highly effective for handling a large volume of files. By combining a simple Windows command with Excel formulas, you can batch create hundreds of file links in seconds.

1
Generate the File List via Command Prompt

Open Command Prompt, navigate to your target folder, and run the command `dir /b > filelist.txt`. This creates a simple text document containing all file names in that folder.

2
Import the Text File into Excel

Open Excel, go to the 'Data' tab, and select 'From Text/CSV'. Browse to the 'filelist.txt' you just created and import the data into your worksheet.

3
Use the HYPERLINK Formula

In a blank column next to your imported file names (e.g., column A), enter the formula `=HYPERLINK("file:///C:/Your/Folder/Path/" & A1, "Open File")`. Replace the path with your actual folder path. Press Enter, then drag the fill handle down to apply the link to all files.

Import Directory List and Apply the HYPERLINK Function
Security Restrictions: Windows or Excel security settings might block local file links from opening. If you encounter an error, check your Trust Center settings or consult your IT administrator for permission.
WPS Spreadsheet Solution

Easily Create and Manage Local File Hyperlinks in WPS Spreadsheet

WPS Spreadsheet provides a seamless and lightweight experience for importing text lists, executing complex formulas, and managing local file URIs without lag.

  1. 1. Import Your File List: Open WPS Spreadsheet, go to the 'Data' tab, and click 'Import Data' to easily load your generated filelist.txt into the workspace.
  2. 2. Apply the File URI Formula: Select an adjacent cell and input `=HYPERLINK("file:///C:/YourPath/" & A1, "Click Here")` using standard syntax.
  3. 3. Drag to Batch Create Links: Press Enter, click the cell, and drag the small square at the bottom-right corner to instantly generate links for your entire file list.
Fully compatible with Microsoft Excel's HYPERLINK function and URI formats.Easily import CSV and text files generated by command-line tools.Lightweight architecture ensures smooth scrolling even with thousands of linked files.Free and intuitive interface for seamless data management and file tracking.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a security warning when clicking a local file link in Excel?

Spreadsheet applications include security features that warn you before opening local files to prevent malware execution. You can adjust these warning prompts by going to File > Options > Trust Center > Trust Center Settings.

Can I link to a specific folder instead of an individual file?

Yes. You can link directly to a folder directory by using the folder path in your formula, such as =HYPERLINK("file:///C:/MyFolder/", "Open Folder"). Clicking this link will open the directory in Windows File Explorer.

Why isn't my file URI hyperlink working properly?

Ensure your file path follows the correct URI syntax starting with 'file:///', replacing backslashes with forward slashes (e.g., file:///C:/Folder/File.ext). Also, verify that the target file has not been renamed or moved.

Is it possible to hyperlink to a file located on a shared network drive?

Yes. You can use the network path (UNC path) in your HYPERLINK formula, such as =HYPERLINK("file:////ServerName/SharedFolder/File.ext", "Open Network File"). Ensure you are connected to the network and have the necessary access permissions.