title: Import from excel to data table vb.net
body: <p>I have imported the excel sheet to data table by using the below code but the few cell value could not be loaded properly. instead of the cell value it is displayed as null.<br>
  Please refer the attached the image of the excel and data table.</p>
  
  <pre><code>Dim conStr As String = ""
  
  conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=Yes'"
  conStr = String.Format(conStr, Path)
  Dim connExcel As New OleDbConnection(conStr)
  Dim cmdExcel As New OleDbCommand()
  Dim oda As New OleDbDataAdapter()
  cmdExcel.Connection = connExcel
  'Get the name of First Sheet
  connExcel.Open()
  dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
  Dim SheetName As String = ""
  If dtExcelSchema.Rows.Count &gt; 0 Then
      SheetName = dtExcelSchema.Rows(dtExcelSchema.Rows.Count - 1)("TABLE_NAME").ToString()
  End If
  connExcel.Close()
  'Read Data from First Sheet
  connExcel.Open()
  cmdExcel.CommandText = "SELECT * From [" &amp; SheetName &amp; "]"
  oda.SelectCommand = cmdExcel
  oda.Fill(dt)
  dt.TableName = SheetName.ToString().Replace("$", "")
  connExcel.Close()
  Return dt
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ogZWe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ogZWe.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/dqZiZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dqZiZ.jpg" alt="enter image description here"></a></p>