2

I'm been trying to read a set of tables placed in the same worksheet using OLEDB , but I can't find a method that lists the tables in a sheet.

This is what I've been trying with OLEDB:

        DataTable dtExcelSchema;
        //Get the Schema of the WorkBook
        dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
        connExcel.Close();
        //Read Data from Sheet1
        connExcel.Open();
        OleDbDataAdapter da = new OleDbDataAdapter();
        DataSet ds = new DataSet();            
        cmdExcel.CommandText = "SELECT * From [" + "Sheet1$" + "]";            
        da.SelectCommand = cmdExcel;
        da.Fill(ds);

But the dataset ends up with all the tables in the same place, it's just as it'd get the whole area containing all the tables and that's definitely not what I need.

Do you know of any library that allows me to read multiple tables(if possible by name) in the same worksheet??

Thanks in advance.

eddy
  • 4,373
  • 16
  • 60
  • 94

0 Answers0