0

I am unable to read excel sheet to data table which has change in orientation for reference of excel sheet i am trying to upload in asp.net

i have attached image below

sheet i am uploading as u can see hub location,region ,location column is not oriented So data table is not able to get the results

sheet i am uploading as u can see hub location column is not oriented So data table is not able to get the results

For more help i am even uploading the generated DATA TABLE IMAGE of above excel sheet

enter image description here

enter image description here

Vipul Handa
  • 109
  • 1
  • 10
  • 1
    can you put your code here? what you tried? – Purvesh Desai Aug 21 '13 at 09:00
  • OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", oledbConn); OleDbDataAdapter oleda = new OleDbDataAdapter(); oleda.SelectCommand = cmd; DataSet ds = new DataSet(); oleda.Fill(ds); ExcelSheetData = ds.Tables[0];] – Vipul Handa Aug 21 '13 at 10:15

1 Answers1

0
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", oledbConn); 
OleDbDataAdapter oleda = new OleDbDataAdapter(); 
oleda.SelectCommand = cmd; 
DataSet ds = new DataSet();
oleda.Fill(ds, "XLData");
ExcelSheetData = ds.Tables[0];

Try this, because you need to give Name of the source table to use for table mapping.

Purvesh Desai
  • 1,797
  • 2
  • 15
  • 39