Excel Office Scripts: Automatically Create Server Links from Job Numbers
Question details
The user needs to automatically convert Excel job numbers into hyperlinks that open the corresponding server folders.
- Product
- Microsoft Excel Office Scripts
- Device & OS
- not provided
- Scenario
- Each job is stored in a server folder whose path includes the job number, and the workbook contains a column of those job numbers.
- Observed behavior
- The job numbers are not automatically linked to their corresponding server folders; a script is needed to build the paths and apply HYPERLINK formulas.
Confirm the job numbers are in the expected worksheet column and obtain the exact server-folder path pattern. Verify that users have permission to access the folders, then test the script on a copy of the workbook.
Use an Excel Office Script to generate server-folder hyperlinks
Use this method when job numbers are listed in column A and each server-folder path follows the same job-number pattern.
The script reads the used range, takes each value in column A as a job number, builds a server path, and replaces the cell content with a HYPERLINK formula. Update the placeholder path before running it.
The script is intended for Excel versions that support Office Scripts, such as Excel for the web or supported Microsoft 365 installations.
Open the workbook in Excel for the web or a supported Microsoft 365 version, select the Automate tab, and choose New Script.
Replace the generated script with the following code, then change the placeholder server path to the real location: function main(workbook: ExcelScript.Workbook) { let sheet = workbook.getActiveWorksheet(); let range = sheet.getUsedRange(true); let values = range.getValues(); for (let i = 0; i < values.length; i++) { let jobNumber = values[i][0]; let filePath = "path_to_your_server_folder/" + jobNumber + "/"; range.getCell(i, 0).setFormula(`=HYPERLINK("${filePath}","${jobNumber}")`); } }
In the Office Scripts editor, select Save, then select Run. The script reads column A and applies a hyperlink formula to each populated row.
Select several linked job numbers and confirm that they open the intended server folders. If a link fails, check the path format, job-number value, and folder permissions.
Create hyperlink formulas without a script
Use this option for a small or stable list when the server path can be generated directly from the job-number cells.
Use WPS Office as a Lightweight Alternative for Job-Number Hyperlinks
WPS Office provides a familiar spreadsheet interface for opening and editing Excel workbooks, including HYPERLINK formulas and common .xlsx content. It is free, lightweight, and supports a smooth migration for teams that need to manage job-number links without changing their everyday spreadsheet workflow.
- 1. Open the workbook in WPS Spreadsheets: Launch WPS Office, choose Spreadsheets, and open the existing .xlsx workbook containing the job numbers.
- 2. Add the hyperlink formula: In a destination cell, use a formula such as =HYPERLINK("\\ServerName\Jobs\"&A2&"\",A2), replacing the server path with the correct location.
- 3. Fill and verify the links: Copy the formula down the job list, select several links, and confirm that the server folders open correctly.

Frequently Asked Questions
Where should the job numbers be stored for the sample Office Script?
The sample script expects job numbers in column A of the active worksheet. If they are in another column, update the script so it reads that column and writes the formulas to the intended cells.
What server path should replace the placeholder in the script?
Replace path_to_your_server_folder/ with the real shared-folder location, such as a valid UNC path or approved server URL. The final path must match the folder structure used by your organization.
Why does a generated server hyperlink fail to open?
Check that the path is correctly formatted, the job number matches the folder name exactly, and the user has permission to access the server location. Test the same path directly in File Explorer or the relevant network application.
Can the script overwrite the original job numbers?
Yes. The sample writes the HYPERLINK formula into the same cells in column A, so the displayed value becomes the linked job number. Copy the job-number column or change the destination range if the original values must remain unchanged.
Does WPS Office run Excel Office Scripts?
Office Scripts are a Microsoft Excel automation feature and are not the same as standard spreadsheet formulas. In WPS Spreadsheets, use HYPERLINK formulas for direct link creation or use a compatible macro workflow where available.




