About Me

Thursday, November 18, 2010

Maximum length of Excel worksheet name can't be more then 31 characters

Today I was faced with very weird issue.
In our programm we are generating Excel reports.
There are many page in it. 
Each of the page is describing its own location.
Location names are storing in the database and putting to the Excel document as the name of the sheet.

Today, people started  complaint that they can't open the file.
During opening, Excel show very strange exception about incorrect format of the file:


The content of the log file told me, that the content of the file is wrong, but did not tell me where exactly is the issue. So, i had to start searching  it by myself.
I found that nothing has changed in the database except of  few new locations were added.
After comparing that locations with other that was added earlier, we found, that few of them are very long.

I had to cut the name of the location to 31 characters to solve the issue.



If you editing Excel file manually, Excel does not let you to type more then 31 characters in the name of the sheet. But, if you creating document dynamically, as we do with some .NET component, its easy to avoid this limitation and enter any length you want.

So, even in Microsoft Office 10, the name of the Excel sheet has so huge limitation.

No comments:

Post a Comment