logo
search
Document Editing Problems

How to Insert File Path in Word Documents Generated from Excel

Aamir Naveed AkramAamir Naveed Akram Oct 8, 2026 868 views

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.

How to Insert File Path in Word Documents Generated from Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Reveal Field Codes

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

2
Add the Path Switch

Click inside the brackets of the FILENAME field and type '\p'. The complete field code should now look exactly like this: { FILENAME \p }.

3
Update the Field

Select the entire field and press 'F9' to update it. The document will now retrieve the full file path.

4
Hide Field Codes

Press 'Alt + F9' again to toggle back to the normal view. The full path and filename of your document will now be displayed.

Manually Edit Field Codes to Add the Path Switch
Updating Fields After Moving Files: If you move the document to a new folder later, the path will not update automatically. You must select the text and press 'F9' to refresh the displayed path.
Efficient Document Generation

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. 1. Open WPS Writer: Launch WPS Office and open your text document.
  2. 2. Navigate to the Insert Tab: Click on the 'Insert' tab in the top ribbon menu, then select 'Field'.
  3. 3. Choose Document Information: In the Field dialog, select 'Document Information' and click on 'FileName'.
  4. 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.
Intuitive graphical interface for inserting fields and file pathsSeamless Mail Merge integration with Excel spreadsheetsFully compatible with Microsoft Word document formats (.docx)Lightweight, fast, and completely free to use
QA img-9

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.