Excel XML error: “Too many tags”
17 Feb 2006
in mid-morning
Matt Winckler
When generating an Excel spreadsheet from XML (I’m using XSLT to transform some original XML into a workbook following Microsoft’s schema), the other day I ran into a problem opening the workbook. It described the error as “Workbook Setting” and referenced a logfile. The logfile contains the following highly informative text:
XML ERROR in Workbook Setting
REASON: Too many tags
FILE: C:\DOCUME~1\d3m853\LOCALS~1\Temp\GenerateCostsheet-44.xls
GROUP: Workbook
TAG: Worksheet
ATTRIB: Name
VALUE: IDC-Subtask1
In typical Microsoft fashion, it tells you almost nothing useful. “Too many tags”? As it turns out, what this means is that there are two worksheets named the same thing, which is Not Allowed. (I don’t know how I could have misunderstood the error message the first time - obviously it’s talking about two worksheet names that are the same!) Name the worksheets something unique, and the problem will go away.

Thanks! I ran into this crap recently as well
Thanks from here too! You saved my butt. Great detective work.
Thanks from me as well. I should have remembered it as its not the first time ive come across it.
Thanks - great help!
Before seeing your solution, I am confused and unable to fix the prob.
Now very happy.
Regards
Yes, that’s correct for one bad defined XMLExcel file.
But I get this issue when my website export one XMLExcel file with 5 Sheets.
If I save this file to local storage then open it - this issue never occurs.
But I chose directly open this file then sometime this issue occur.
Have you got any idea?
Thanks & best regards,
Marvelous work! Exactly my problem too! Thanks.
I got this error when adding cells to a worksheet but not ‘trimming’ the strings correctly. Adding the cells would work if I did it with a bit of test data statically in the code but when I referenced real data from a row in a dataset I had to ‘trim’ the strings with the VB.NET function ‘.trim’. Perhaps it’s my particular data but it’s worth mentioning.
This happened to me recently with a monsterous spreadsheet that had a duplicate ‘Default’ style (two entries with the same Id tag seems to be the trick). When I exported it, there were two ‘Default’ styles in the tag, causing an error when re-opening the XML file. Removing it from the XML eliminated the problem. Now I just have to figure out how to get rid of this odd style.
My errors were:
XML ERROR in Style
REASON: Bad Value
XML ERROR in Style
REASON: Too many tags
Solved them by removing the tag at the beginning of the XML.
By removing the nameless ‘default’ tag, I meant.
I ran into something similar from a .xml written by Excel 2003.
XML ERROR in Style
REASON: Too many tags
FILE: MyFileName.xml
GROUP: Styles
TAG: Style
ATTRIB: Name
VALUE: Normal
Turned out that two Style elements had the same ss:Name attribute values. Both “Default” and “s21″ had ss:Name=”Normal”.
I got rid of one of the name attributes ( the one on the Default Style) and Excel read again. Upon re-writing, the second “Normal” was magically changed to “Normal_”.
I also cam across this error while trying to use the CarlosAg.ExcelXmlWriter.
I had multiple sheets in a workbook, which were named uniquely, but I then added a style, and style names must be unique for each worksheet as well.
I ended up appending the worksheet name to the style name.
In my case I was getting the follwoing error:-
XML ERROR in Workbook Setting
REASON: Too many tags
FILE: C:\Documents and Settings\mylogin\Local Settings\Temporary Internet Files\Content.IE5\KTEZW9ER\PCAPAnalysis[1].xls
GROUP: Workbook
TAG: Worksheet
ATTRIB: Name
VALUE: Detailed Report
It does not come up anymore since I changed the name of the file to a dynamically generated random number in the contentdisposition header of the response. I have a web application and having the same filename in the response header some how gave teh above error.
Works Y removed
Ad than works thnaks a lot.
as per Kunal Bhambhani,
I was getting the error because of duplicated workbooks with the same name. I fixed it by adding a random number and the users name. (random number alone seemed kinda weird)
If you’re appending a number anyway, I would recommend just using a sequential integer (0, 1, 2, 3…n) when generating the workbooks. Random numbers, by definition, are not guaranteed to be unique. You have just as much chance of generating random number
Na second time as you did of generating it the first time.Wow, thanks!!!!!!!!
Microsoft has so usefull explanations ;)