We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

A reference is invalid error appears when file name contains square brackets


We have found an issue with refreshing a file on opening when the file name contains a square bracket i.e. “[” and “]”. When the file has a bracketed file name AND it has a pivot table, it displays a “Reference is invalid” error.

I have attached a small project to demonstrate the issue. I have also attached two input files, one with a pivot table “input file for brackets file names issue.xlsx” and another without a pivot table “input file for brackets file names issue without a pivot table.xlsx”. Both generated files will be saved in the same directory as the input file.

When you run the project the following files are generated:

  1. generatedFile[in brackets].xlsx
  2. generatedFile(in brackets).xlsx
  3. generatedFile without brackets”.xlsx"

Only the 2nd generated file shows the reference error.


Thanks for your posting and using Aspose.Cells for .NET.

We were able to replicate this issue using your sample project and source file. The generated file with square brackets shows error. We have logged this issue in our database. We will look into it and resolve this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41846.


We have checked on Excel to see what happens when you save a file with a name containing square brackets and found that excel does not accept these and a few other characters. We will handle the naming issue before calling the Aspose.Cells assembly, but we thought it would help to let you know why the error appears (in case you haven’t found out yet).

I have attached a screenshot of the error message for your reference.

“The file could not be accessed. Try one of the following:

  • Make sure the specified folder exists.
  • Make sure the folder that contains the file is not read-only.
  • Make sure the file name does not contain any of the following characters: < > ? [ ] : | or *
  • Make sure the file/path doesn’t contain more than 218 characters.


Thanks for your posting and using Aspose.Cells for .NET.

It seems the error is related to MS-Excel and not Aspose.Cells. We have logged your comments in our database. We will look into it and update you asap.


Thanks for using Aspose.Cells.

This issue is related to MS Excel and not Aspose.Cells. If you create a file with [ ],you will still find this issue.

Thanks for your understanding.