I have excel sheet that contains huge amount of data in the sense that excel contains 7000+ rows and whenever I’m reading with the help of read renge it’s taking time.if anyone having invoke code for reading data from excel sheet and store it in the datatable so please help me
A lot of data is going to take time to load, it’s just that simple and there is no way around it. Are you using Excel Read Range or workbook Read Range? The workbook activity is generally faster.
Hello Vikas,
Thanks for Replying But I dont Know How to Build a Connection String If You have any Idea Or Related Videos Can You Please Share with Me ??
Dim conStr As String = ""
conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
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 > 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 [" & SheetName & "]"
oda.SelectCommand = cmdExcel
oda.Fill(dt)
dt.TableName = SheetName.ToString().Replace("$", "")
connExcel.Close()
Return dt
Hello @Palaniyappan I tried with connection string and its working I’m Posting whole solution. I tried the 12000 rows Data Reading and its Reading in just 6 sec.