Display an Excel Workbook File Name and Path with CELL
Question details
Display the full path, workbook file name, and worksheet name in an Excel cell.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants a formula that shows where the current workbook is saved and identifies the worksheet.
- Observed behavior
- A cell displays the saved workbook's path and file name, with or without the worksheet name.
Save the workbook using File > Save or Save As before entering the formula. CELL cannot return the file name and path for a workbook that has not been saved.
Display the workbook path, file name, and sheet name
Use CELL with a worksheet reference to show the full workbook location and sheet name.
Open the saved workbook and click the cell where you want the location to appear.
Type =CELL("filename",A1) and press Enter. The A1 reference identifies the worksheet whose name should be returned.
Look at the selected cell for a result such as C:\Reports\[Budget.xlsx]Sheet1. The exact path depends on where the workbook is saved.

Display the workbook path and file name without the sheet name
Use a formula that removes the sheet name and workbook brackets from the CELL result.
Show a Workbook File Path in WPS Spreadsheets
Use the CELL function in WPS Spreadsheets to display a saved workbook's path, file name, and worksheet name in a cell.
- 1. Open the workbook: In WPS Spreadsheets, select Open and choose your workbook.
- 2. Save the file: Use File > Save or Save As if the workbook has not yet been saved.
- 3. Enter the formula: Click a cell, type =CELL("filename",A1), and press Enter to display the path, workbook name, and sheet name.
- 4. Remove the sheet name if needed: To show only the path and file name, enter =SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))-1),"[","") in a cell.

Frequently Asked Questions
Why does CELL return an empty result for the file name?
The workbook may not have been saved yet. Use File > Save As to save it, then check =CELL("filename",A1) again.
How do I show the file path without the worksheet name?
Enter =SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))-1),"[","") in a cell. This formula may not work correctly if the path or file name contains square brackets.
Why include A1 in the CELL formula?
In =CELL("filename",A1), A1 identifies the worksheet whose name should appear. Use a reference on the worksheet you want to identify.
Can I use the same formula in WPS Spreadsheets?
Yes. Open and save the workbook in WPS Spreadsheets, then enter =CELL("filename",A1) in a cell to display its location and worksheet name.




