Look at this post: Excel "The external table is not in the expected format."
I have the same problem as in this post, but I use LinqtoExcel to read the file instead of simple queries.
What will be the equivalent of LinqToExcel for setting the connection string, as the answer to this post suggests?
Here is the code I'm using:
var excelOM = new ExcelQueryFactory(pPathArchivoOM);
var despachosClient = from c in excelOM.Worksheet<RegistroDespachoOM>("Tabla_1")
where c.DESTINAT.Contains("SOMETEXT")
select c;
foreach (RegistroDespachoOM despacho in despachosClient)
{ ...
And my problem is: "The external table is not in the expected format" at the beginning of foreach.
EDIT (my problem is resolved, but the question remains unanswered): I use EPPlus instead of LinqToExcel for this task, and now everything works fine.
source
share