Xlsx reading saved as xls with LinqToExcel

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;
//Identificar los despachos asociados a números de documento sin datos aún.
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.

+5
source share
1 answer

ACE JET.

LinqToExcel, DatabaseEngine.

var excelOM = new ExcelQueryFactory(pPathArchivoOM);
excelOM.DatabaseEngine = DatabaseEngine.Ace;
+5

All Articles