0

I try to open an excel file and read the data but it always throw an error "External table is not in the expected format" i tried all possible connection strings but it also raise the error. my connection string is

@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + this._filePath + ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;" 

i also tried

@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + this._filePath + ";Extended Properties=Excel 12.0;HDR=Yes;IMEX=1;"

but it failed

and the file extension is .xls

thanks in advance

Mounir
  • 281
  • 3
  • 10
  • 25
  • Can you open that _filePath with Excel? – Steve Jan 09 '13 at 13:24
  • you are right .it raise the error too when i try to open it with excel. "different format than specified by the file extension" so i think the problem is in save function. as i download the file then read it. – Mounir Jan 09 '13 at 13:30
  • Dear Steve, do you have a solution to solve this issue without change in save function ? – Mounir Jan 09 '13 at 14:02
  • You could try just changing the file extension to see if that makes a difference when opening it in Excel. Do you have control over the saving of the file? If not, I think you might be out of luck. – Sid Holland Jan 09 '13 at 16:12
  • i try to solve it by opening the file then save it manually and it works fine but if i saved it from web it cause this error. i know that the problem is in the export function but i don't know how to solve it – Mounir Jan 09 '13 at 17:38

0 Answers0