Question

I've been using LinqToExcel to parse an exel document for a while and suddenly it's stoped working.

I'm getting the following error:

External table is not in the expected format.

Any ideas why this is happening? Or how to fix?

 if (File.Exists(filenameFull))
            {
                var excel = new ExcelQueryFactory(filenameFull);

                IList<Row> scanningRangesRows = 
                        excel.Worksheet("B - Scanning Ranges").ToList();

I was using version LinqToExcel 1.6.3, when the problem started happening I updated to the latest version LinqToExcel 1.6.6 to no avail.

I've just noticed that the file I'm downloading is significantly smaller than previous verisons. I opened it in notepad and I can see [Content_Types].xml amongst the binary data. So it appears that the data source is now being saved as an xml represention of the xls file with the same extension. When I open the same file manually in Excel it popup with

The file you are trying to open '', is in a different format than specified by the file extension. Verify that the file is from a trusted source before opening the file. Do you want to open the file now?

On clicking yes the file still opens and looks the same as previous versions.

Était-ce utile?

La solution

It's probably something to do with the file.

Maybe it's being saved as an .xlsx type of file. Can you try renaming the file extenstion to .xlsx and see if that works.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top