How to access the file name in Excel 365

Copper Contributor

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
I wish I knew!
And 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).
I've been struggling with this and MS has still not addressed it

@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)

@DFClark 

 

Yes this is limitation under Online version