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.

18 vociferations follow:

  1. 11 months, 1 week after the fact, chris responded:

    Thanks! I ran into this crap recently as well

  2. * * * * *
    11 months, 3 weeks after the fact, Scott responded:

    Thanks from here too! You saved my butt. Great detective work.

  3. * * * * *
    1 year, 1 month after the fact, Robert responded:

    Thanks from me as well. I should have remembered it as its not the first time ive come across it.

  4. * * * * *
    1 year, 3 months after the fact, Russ responded:

    Thanks - great help!

  5. * * * * *
    1 year, 4 months after the fact, Kannan responded:

    Before seeing your solution, I am confused and unable to fix the prob.
    Now very happy.
    Regards

  6. * * * * *
    1 year, 7 months after the fact, NGHI responded:

    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,

  7. * * * * *
    1 year, 9 months after the fact, Pete The Van responded:

    Marvelous work! Exactly my problem too! Thanks.

  8. * * * * *
    1 year, 11 months after the fact, Jason responded:

    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.

  9. * * * * *
    2 years, 2 months after the fact, RL responded:

    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.

  10. * * * * *
    2 years, 2 months after the fact, Adrian responded:

    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.

  11. * * * * *
    2 years, 2 months after the fact, Adrian responded:

    By removing the nameless ‘default’ tag, I meant.

  12. * * * * *
    2 years, 4 months after the fact, Alan Painter responded:

    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_”.

  13. * * * * *
    2 years, 4 months after the fact, TulsaDev responded:

    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.

  14. * * * * *
    2 years, 6 months after the fact, Kunal Bhambhani responded:

    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.

  15. * * * * *
    2 years, 10 months after the fact, OryK responded:

    Works Y removed

    Ad than works thnaks a lot.

  16. * * * * *
    2 years, 11 months after the fact, Brian responded:

    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)

  17. * * * * *
    2 years, 11 months after the fact, Matt Winckler responded:

    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 N a second time as you did of generating it the first time.

  18. * * * * *
    3 years, 2 months after the fact, Julie responded:

    Wow, thanks!!!!!!!!

    Microsoft has so usefull explanations ;)

React

You must be logged in to post a comment.

 
order clomid viagra online review cialis from canada cheap generic viagra compare cialis prices online buy cheap acomplia buy viagra no rx find discount viagra online cheap accutane online lasix pills drug cialis online purchase order discount viagra order viagra from canada cheap lasix online online propecia viagra information accutane prices cheap generic acomplia levitra generic cialis cost levitra without prescription propecia prescription buy acomplia cheap acomplia prices acomplia cheap discount viagra purchase cialis no rx buy cialis us synthroid buy cheap cialis cheap zithromax cialis drug lowest price lasix clomid online cheap order acomplia online viagra online cheapest soma prices order cialis no rx cialis without a prescription cheap clomid buy viagra without prescription cheap generic accutane buy propecia without prescription cialis free sample propecia pharmacy buy viagra from us zithromax cheap buy levitra generic propecia no rx viagra cialis tablets cialis without prescription generic viagra cheap generic accutane discount cialis online clomid cheap buy discount viagra cheap viagra on internet overnight viagra viagra uk buy viagra from canada buy generic accutane viagra no prescription zithromax pills cheapest synthroid prices discount synthroid where to buy zithromax cheapest zithromax prices buy soma without prescription accutane no prescription cheap levitra tablets find cheap cialis online levitra pills