I'm trying to read an .xls file that happens to have a very large text cell (around 8900 chars) using System.Data.OleDb
and the Microsoft ACE OLEDB provider. I have no control over the content of the .xls file.
I get the following exception when trying to .Open()
the OleDbConnection
:
Exception thrown: 'System.Data.OleDb.OleDbException' in System.Data.dll
Additional information: External table is not in the expected format.
I have minimized the .xls file and it seems that the text cell is what is causing the exception. I have MS Office 2010 x86 installed on an x64 OS.
I have tried all of the following, none of which solved the problem:
- ACE 12.0 x86
- ACE 12.0 x64
- ACE 15.0 x32
- registry tweak to set TypeGuessRows = 0
- connection string IMEX=1
- connection string Extended Properties="Excel 8.0;"
- connection string Extended Properties="Excel 12.0;"
From my research it seems that the old JET provider used to truncate fields to 255 chars. I can't get ACE to read the file at all without throwing the exception.
C#
,VB.NET
, or whatever. That said, I am unable to reproduce your issue from C#. Can you provide a link to a small sample .xls file that will demonstrate the error? – Gord Thompson