Forum Discussion
DFClark
Apr 13, 2022Copper Contributor
How to access the file name in Excel 365
In Excel the name of the current spreadsheet file can be obtained using the CELL function with the info-type set to "filename". In Excel 365 this is not supported ("Note: This value is not supported in Excel for the web, Excel Mobile, and Excel Starter."). How can a spreadsheet determine its file name in Excel 365 (aka Excel for the web)?
5 Replies
Sort By
- GLComputingBrass ContributorI've been struggling with this and MS has still not addressed it
- Guy_BoswellBrass ContributorI wish I knew!
- peterrosenbergCopper ContributorAnd if you only want your workbook filename (minus Path), you can use this trick:
=TEXTBEFORE(TAKE(TEXTSPLIT(CELL("filename");"/";-1);;-1);"]")
Provided you have the Excel 365 functions added Spring 2023 (DROP, TAKE, TEXTSPLIT).- Jay-likes-lasersCopper Contributor
peterrosenberg Using this solution, it returns me a filename which unfortunately starts with an additional "[" character. I tried using
=TEXTAFTER("[",TEXTBEFORE(TAKE(TEXTSPLIT(CELL("filename"),"/",-1),,-1),"]"))
but this returns #N/A.
I did a quick workaround, by using RIGHT() and LEN()-1; giving the desired result:
=RIGHT(TEXTBEFORE(TAKE(TEXTSPLIT(CELL("filename"),"/",-1),,-1),"]"),LEN(TEXTBEFORE(TAKE(TEXTSPLIT(CELL("filename"),"/",-1),,-1),"]"))-1)