How to Insert File Path in Word Documents Generated from Excel
Question details
The user wants to automatically display the name and full file path in Word documents created from Excel column values, specifically when the standard interface options are missing.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Generating multiple Word documents from Excel data and needing to automatically embed each document's file path into the text or footer.
- Observed behavior
- The standard 'Include path to file' checkbox is sometimes unavailable or difficult to find, preventing the user from displaying the full document path.
Ensure your Word document has been saved to a specific location on your computer at least once, as unsaved documents do not have a valid file path to display.
Manually Edit Field Codes to Add the Path Switch
If the 'Include path to file' checkbox is missing from the interface, you can manually modify the field code to force the document to display its full path.
Word uses field codes to generate dynamic content like filenames. By revealing these codes, you can directly append the path switch (\p) to the FILENAME field, bypassing the need for interface checkboxes.
Press 'Alt + F9' on your keyboard. This will toggle the document view to show field codes instead of field results. Existing fields will appear in curly brackets, such as { FILENAME }.
Click inside the brackets of the FILENAME field and type '\p'. The complete field code should now look exactly like this: { FILENAME \p }.
Select the entire field and press 'F9' to update it. The document will now retrieve the full file path.
Press 'Alt + F9' again to toggle back to the normal view. The full path and filename of your document will now be displayed.

Insert Filename and Path via the Field Dialog Box
Use Word's built-in Insert menu to add the filename and select the option to include the file path without typing manual codes.
Easily Insert File Paths and Merge Excel Data in WPS Writer
WPS Writer offers a highly intuitive Field insertion and Mail Merge interface, making it incredibly simple to generate documents from Excel data and automatically include dynamic file paths without memorizing complex field codes.
- 1. Open WPS Writer: Launch WPS Office and open your text document.
- 2. Navigate to the Insert Tab: Click on the 'Insert' tab in the top ribbon menu, then select 'Field'.
- 3. Choose Document Information: In the Field dialog, select 'Document Information' and click on 'FileName'.
- 4. Enable Path Inclusion: Simply check the 'Add path to filename' option and click OK to instantly generate the full file path in your document.

Frequently Asked Questions
Why does my file path only say 'Document1'?
This happens when the document has not yet been saved to your computer. 'Document1' is the temporary name. Once you save the file to a specific folder, press F9 on the field to update it with the actual file path.
How do I update the file path if I move the document to a different folder?
Field codes do not update dynamically in real-time. If you move or rename the document, open it, select the entire document by pressing Ctrl+A, and press F9 to force all fields, including the file path, to refresh.
Can I put the file path in the header or footer instead of the main text?
Yes. Double-click the header or footer area of your document to open it. From there, you can follow the same steps to insert the { FILENAME \p } field code or use the Field dialog box.
Why does pressing Alt+F9 not reveal the field codes on my laptop?
On many modern laptops, the F9 key requires the Function (Fn) key to be pressed simultaneously. Try pressing 'Alt + Fn + F9' to toggle the field codes.




