Invalid characters in a file name

I’m trying to read some files that have the characters ‘[’ and ‘]’ in the file name and get the following error:

An error occurred: 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 filename and folder path do not contain any of the following characters: < > ? [ ] : | or *
• Make sure the filename and folder path do not contain more than 218 characters.

Does Aspose not support files that have those characters in its name?

@eyang23,

Please note, in Windows operating systems, the following characters are not allowed to be used in file names: \ / : ? * < > |" (see the document for your reference). So, how did you create or get those Excel file(s) containing these reserved chars in their names? Could you zip and attach some sample files for reference? We will check it soon.

Here’s a zip file with them - I got them through another link that was passed to me. But I also have no issues with renaming to include the brackets. I’m not allowed to rename it to any of the other characters though.

invalid sheet names.zip (26.6 KB)

@eyang23,

I tested your scenario/case a bit by loading your provided files into Aspose.Cells.Workbook object model and then re-saved it, it works fine and I do not find any issue what so ever. Here are my simplest lines of code that I tried with your files:
e.g.
Sample code:

Workbook workbook = new Workbook("g:\\test2\\] []'.xlsx!more'[x]!a7.xls");
//Workbook workbook = new Workbook("g:\\test2\\[Book1]Sheet1]'].xlsx");
workbook.Save("g:\\test2\\out1.xlsx");

The output Excel files are also fine tuned.

PS. I am using latest version of the APIs

Ah ok, so it’s likely not an issue with Aspose then?

@eyang23,

Yes, it seems so.
If you find any issue, kindly do share your sample code (runnable) and sample files(if other than what you attached in the zipped archive) to reproduce the issue on our end, we will check it soon.