How to get full workbook name and path in Excel
If you want to get the current workbook’s full path, name, and sheet with a formula, you can use the CELL function and a reference to any cell in the workbook. CELL will return the name in this format:
path[workbook.xlsx]sheetname
Note that you must save the worksheet in order to get the a result.
Formula
=CELL("filename",A1)
Explanation
A note about the reference argument
The CELL function has an optional second argument called “reference”. If reference is not supplied, CELL will return the name of the current “active sheet” which may or may not be the sheet where the formula exists, and might even be in a different workbook. To eliminate confusion, supply A1 for reference when you are getting the filename.