Free Support Forum - aspose.com

Excel.open throws "The same worksheet name already exists"

I am working the Aspose.Cells 3.7.2.0, the EVALUATION version, to determine if the product is right for our application. I use the following code to open an existing workbook file:

Excel exce = new Excel();
if (File.Exists(filename)) {
try {
excel.Open(filename);
}
catch (Exception e) {
// SHOULD NOT GET HERE
}
}

this code is catching the “The same worksheet name already exists” after running a few times against the same Aspose.Cells generated file.

I don’t see anything that could be wrong in my code, and am hoping this is just nasty behavior in the evaluation version caused by its inserting the Evaluation Copyright Warning sheet without incrementing its internal counter? I’m seeing sheets with the names:

Evaluation Copyright Warning
Evaluation Copyright Warning (0
Evaluation Copyright Warning (0)


It sure looks like the intent is to increment the number within parenthesis, but apparently that isn’t happening and instead this error is being thrown? This is rather disconcerting as it makes the Aspose.Cells product appear unstable.

Thanks for your report. Could you post your file which caused this problem here?

Here is the workbook file at the point where opening it with Aspose.Cells causes the exception I described.

Thanks for your report. Please try this attached fix.

In MS Excel, the length of worksheet name should be less than 32. However, length of "Evaluation Copyright Warning (0)" is 32.

Now Aspose.Cells will still throw exception when reading your file because this file does have problem. But with this new fix, you won't create such a file.

The new version works like a champ and will hold me until our license arrives.

Thank you.

-Marc

Hi,

I'm having the same problem that Marc reported long ago so I decided to reuse this topic.

I'm working with an application that uses Aspose.Excel and Aspose.PDF. The company owner of this application has paid the Aspose licenses so we are suposed to use full versions of them. But when I generate excel files they are created with a sheet named "Evaluation Copyright Warning" so it seems that we have a problem with the license. This is only to let you know what kind of component version are we using.

The real problem is that when I generate the same excel more than 3 times it crashes with "The same worksheet name already exists" message. I tried to debug my code but it crashes in the myExcel.Open() statement.

¿Any suggestion?

My installed version of Aspose.Excel is 3.6.1.0

PD: I've verified the name of the generated document and it's minor than 32 char.

Thank and sorry for my english, I can't practice it often ;)

This is an old problem and is already fixed. You can download and try new version of Aspose.Cells.

It seems that your program doesn't find the license file. Please check http://www.aspose.com/wiki/default.aspx/Aspose.Cells/Licensing.html .

To solve this problem, you can try:

1. Call license code with explicit path

Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(@"d:\license\Aspose.Cells.lic");

2. Build the license file as an embedded resource in your program.

Ok, thanks, I haven't realized that my component version was older than mgibians'.

I supose it's a problem of our Systems Dept. They have paid the license but they have not distributed it so when I generate the new installer it doesn't contain a valid License file.

And with the new version of the Cells component (I think is the newer version of the older Aspose.Excel) I've tried other thing. My computer software is own of my client, and they are very very slow installing any program so when I try to generate the excel and the program finds that it already exists, I delete the existing file and generate new one.

When they give me time to ask for the new version of Aspose I'll change and put it in the right form.

Thanks for all.