How to Create Excel Links to Local Files Using File URIs
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.

- 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.
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.
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.
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.
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.
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.

Manually Insert Links to Local Files
For a small number of files, you can use the built-in Insert Link feature to manually select and link to local files without using formulas.
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. 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. Apply the File URI Formula: Select an adjacent cell and input `=HYPERLINK("file:///C:/YourPath/" & A1, "Click Here")` using standard syntax.
- 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.

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.




