cancel
Showing results for 
Search instead for 
Did you mean: 

Excel sheet name too long

RitikAnand
Level 3
I am trying to read few .xls files. The sheet name is 31 characters long. When I try to get data from files using Oledb query, it runs fine for some sheets. But for some it throws exception that - "Sheet name is not a valid one. It may contain special chars or punctuation or is too long.". At other times the same file gets read and some other one throws the exception. Sheet name contains no punctuation and special chars. Can anyone tell me why this is happening and how to correct it?
2 REPLIES 2

BenKirimlidis
Level 7
Hi Ritanand, I remember a colleague having a similar issue in the past. She had a file that would be read sometimes and othertimes she was getting the same error. The sheet name was also 31 characters to match the limit in for an Excel sheet name and contained no special characters. She noticed that when the sheetname was 'Sheet1', it always worked. So she shortened the sheet name down from 31 characters to 30 or less.  Whatever applications were being used read the sheet name string in a weird way, and would add an underscore to the end making the sheet name 32 characters when it is read. Maybe someone else has experienced the issue directly and will know the proper solution. Kind regards, Ben

Hi, ritanand, I think if you google a bit you would find it yourself. See below two links even though these are old references you can try it in Excel UI how long sheet name can be. Basically I tested it on Excel 2013 and there is a limit of 30 characters which goes fine and 31 which fails. So I guess that sometimes the sheet will be 30 characters and it will go through and sometimes it will contain one more character and it will fail. https://social.msdn.microsoft.com/Forums/sqlserver/de-DE/53e88252-9d4a-4c3e-8182-956d3fccebcb/maximum-excel-sheet-name-length?forum=sqlintegrationservices https://excelribbon.tips.net/T013175_Using_Very_Long_Worksheet_Tab_Names.html