End Google Ads 201810 - BS.net 01 --> Hi,

I want to read an xls file and import data in dataset. This xls file is a system generated tab delimited file. Using below code I am getting "External table is not in the expected format" exception.

If I open the same file in excel and save it in correct excel format this piece of code works fine.

public static void ReadExcelFileData()
{
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Test.xls;Extended
Properties='Excel 8.0;HDR=Yes;IMEX=1;FMT=TabDelimiter'";


// Establish Connection
_connExcel = new OleDbConnection(connectionString);
_cmdExcel = new OleDbCommand();
_cmdExcel.Connection = _connExcel;

try
{
//Accessing Excel Sheet
_connExcel.Open();

//Code to read excel file
}
catch (Exception ex)
{
throw ex;
}

}
}
}
}

I tried to modify the connectionstring as given below,But it also gave me "c:\Test.xls is not a valid path" error
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Test.xls;Extended
Properties='text;HDR=Yes;IMEX=1;FMT=TabDelimiter'";

If anybody had faced such problem earlier, Please let me know the solution implemented by you.

Thanks & Regards,
Deepak