Skip to main content

Insert file path / name into cell / header or footer in Excel - Full guide

Author: Xiaoyang Last Modified: 2024-05-17

Inserting the file path or file name into a cell, header, or footer in an Excel workbook can be very useful for several reasons, particularly in professional, collaborative, or complex document management scenarios. This guide will help you with each of these tasks, ensuring that you can easily reference file details within your Excel workbooks.


Insert current file path or file name in cell

To display the current file path, file name, file name & current sheet… in a cell, you can use the following formulas:

Item Formula Result
File path only: =LEFT(CELL("filename"),FIND("[",CELL("filename"))-1) C:\Users\skyyang\Desktop\
File name only: =MID(CELL("filename"),SEARCH("[",CELL("filename"))+1, SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1) Excel Data table .xlsx
File name & current sheet: =RIGHT(CELL("filename"),LEN(CELL("filename"))- MAX(IF(NOT(ISERR(SEARCH("\",CELL("filename"), ROW(1:255)))),SEARCH("\",CELL("filename"),ROW(1:255)))))
Array formula: press Ctrl + Shift + Enter keys together
[Excel Data table .xlsx]Sheet2
File path & File name: =SUBSTITUTE(LEFT(CELL("filename"), FIND("]", CELL("filename"))-1), "[", "") C:\Users\skyyang\Desktop\Excel Data table .xlsx
File path & File name & current sheet: =CELL("filename") C:\Users\skyyang\Desktop\[Excel Data table .xlsx]Sheet2
Note: These formulas only work properly in workbooks that have been saved; if the workbook is not saved, they may return a blank or an error value.

Insert current file path or file name in header or footer

If you need to insert file names, file paths, and other document-related information into headers or footers in Excel, here’s a detailed guide on how to incorporate these elements into your Excel documents efficiently.

  1. Open the Header or Footer tab by clicking Insert > Header & Footer, see screenshot:
  2. Decide where to insert the information. You can insert details into the header or footer. Excel divides these into three sections: left, center, or right. Click one section, under the Header & Footer tab, choose File Path, File Name or Sheet Name that you need to insert. See screenshot:
  3. Then click any cell to exit the Header & Footer mode, the file path or name or sheet name will be displayed as following screenshot shown:

Insert current file path or file name or other file information in cell, header or footer

Enhance your Excel workflow and document management efficiency with Kutools for Excel's Insert Workbook Information feature. This powerful tool allows you to effortlessly insert vital information such as the current file path, file name, current date and time, user name and other essential workbook details directly into your cells, headers, or footers.

After installing Kutools for Excel, click Kutools Plus > Workbook > Insert Workbook Information, in the dialog box, choose the workbook information you want to insert from left pane, and then select the place where you want to insert the information at. At last, click OK button. See screenshot:

Insert current file path in Excel ribbon

Having the file path readily available on the Ribbon can save you time, especially when you need to access the file location quickly for saving, sharing, or organizing purposes. This section will talk about how to add file path into the Excel ribbon.

1. Open one Excel file, and then click File > Options, in the Excel Options dialog box:

  • 1) Click Quick Access Toolbar option from the left pane;
  • 2) Then choose All Commands from the Choose commands from drop down list;
  • 3) Scroll to select Document Location from the list box;
  • 4) And then click Add > > button to add the Document Location to the right pane;
  • 5) At last, click OK.
  • doc-insert-file-path1

2. Now, the full path of the current file will display on the left of the ribbon.

  1. Each time you open an Excel file, the file path will always be displayed on the Ribbon.
  2. If you are using Excel 365 or Excel 2021 and the Document Location option is not available in the Excel Options dialog box, you should use the Address [Document Location] option instead, as shown in the screenshot:

Implementing these features not only enhances work efficiency but also improves the readability and manageability of documents, especially when dealing with a large number of files and data, quickly locating the source and status of files becomes particularly important. If you're interested in exploring more Excel tips and tricks, our website offers thousands of tutorials, please click here to access them. Thank you for reading, and we look forward to providing you with more helpful information in the future!

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (3)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello, if I have excel file but only with one tab, what will be the formula? Obviously "[" will not be there because its only one tab in the file. Thanks!
This comment was minimized by the moderator on the site
How to add filepath to excel
This comment was minimized by the moderator on the site
Instructions to add filepath to Excel documents
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations