How to import data from Excel to DataGridView on Visual Basic.NET 2015

Hi see you again on my Visual Basic 2015 learning corner.  Here I will show you how I import data from an Excel files  to a Data Grid View control on Visual Basic .NET 2015.

import excel to datagridview

When the Import button is clicked, it will read and load the data inside the Excel file to DataGridView.

load excel to data grid view vb.net

The code:

The program will read RockType.xls located in my E:\Personal\09. Blog\ folder. If you want to adapt this code you will need to change the source (excel file) location with your own file location. And if you are using Excel file (.xlsx), you will need to edit the connection string with the following:

 

Admin

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.