Excel – How to reference a filename with spaces in Microsoft Excel

filenamesmicrosoft excelworksheet-function

I want to create an external reference to cells in an Excel spreadsheet named Employee Data.xls.

When I enter the formula =[Employee Data.xls]sheet1!A1, I keep getting the error "The name that you entered is not valid. The name contains a space or other invalid characters".

Error message

I've tried a few different formulas, including:

  • =[Employee Data.xls]sheet1!A1
  • =["Employee Data.xls"]sheet1!A1
  • =[Employee%20Data.xls]sheet1!A1
  • =[Employee\ Data.xls]sheet1!A1

The only "solution" I've found is renaming the file to remove the spaces (i.e. EmployeeData.xls).

How can I reference an external file in Excel if the filename contains spaces?

Best Answer

Try it this way:

='[Employee Data.xls]sheet1'!A1

Moreover, if the file is closed, you can add the path in the beginning, i.e.

='C:\My Folder\[Employee Data.xls]sheet1'!A1

p.s. Excel will add the path automatically if you close the file.