Read Excel Sheet Data into DataTable or Dataset
Without using Excel Object we can insert , edit , delete , select etc. in cell content of an Excel file using OLEDB in VB.NET . Here we are using OleDbConnection , OleDbDataAdapter , DataSet for doing these operations in an Excel file. You have to import System.Data in the project for doing these operations . For read the content from Excel file using ado.net , We can use the SELECT command like in SQL Operations.
Import Excel to DataTable
sample Select sql
sql = "select * from [Sheet1$]"
Here is the sample Excel file .
Open the connection using OLEDB Provider
(provider=Microsoft.Jet.OLEDB.4.0;Data Source='Your Filename';Extended Properties=Excel 8.0;)
Specify which data you want to read
select * from [Sheet1$]
Here is the screen short after reading from Excel file .
Fastest way to read an Excel Sheet into a DataTable
When you execute this program you will get the contents in the excel file to the DataGrid.
- How to create an Excel file in VB.NET
- How to open or read an existing Excel file in VB.NET
- How to read an Excel file using VB.Net
- Add new worksheet in Excel file - VB.Net
- Delete worksheet from an excel file - VB.Net
- How to Format Excel Page in VB.NET
- How to insert a Picture in Excel through programing on VB.NET
- How to insert a background Picture in Excel through VB.NET
- How to create a Chart in Excel in VB.NET
- How to export a Chart in Excel as Picture file from VB.NET
- How to Excel Chart in VB.NET Picture Box
- How to Excel DataBar in VB.NET
- How to Excel Data Validation Input Message
- How to insert cell data in an Excel file using OLEDB
- How to update cell data in an Excel file using OLEDB
- How to export from database to excel
- How to export from DataGridView to excel