You can use the CELL function to get the file and sheet names. CELL returns both the file name and sheet name in the format of "C:\Path[FileName.xlsx]SheetName". You can parse out the desired component from that string. So, to get the filename including
the extensdion with
Include "filename" as shown. Do not substitute the actual file name. The reference to A1 can be to any cell on the worksheet. It doens't matter which cell.