The usual way is with Office Interop
Many samples on Google, like :
Read data from an Excel workbook in Visual Basic .NET
How to Read an Excel file in Windows Forms Application using C# and Vb.Net
etc...
Import EXCEL data into Visual Studio 2019
Surendra Singh
1
Reputation point
Can any one suggest me where to look for VB code for importing data from EXCEL into Visual Studio 2019
Developer technologies | VB
Developer technologies | VB
An object-oriented programming language developed by Microsoft that can be used in .NET.
3 answers
Sort by: Most helpful
-
Castorix31 91,506 Reputation points2021-03-01T18:46:21.983+00:00 -
Karen Payne MVP 35,596 Reputation points Volunteer Moderator2021-03-01T19:28:42.78+00:00 - To open Excel with automation see the following code sample.
- With OleDb see the following code sample.
Either way, there is not one ideal method that will work for every file, you will need to tinker with the code in many cases dependent on how things are structured and if there are mixed types in columns which is shown in this code sample for OleDb.
I have a bunch of code samples here.
-
David 151 Reputation points
2021-03-29T09:21:53.647+00:00 Try this solution. More details can be found through this link - https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Excel-Import/Export-Import-Data-from-Excel-to-Datatable.html
Dim workbook As Workbook = New Workbook workbook.LoadFromFile(..\ FandH.xlsx) Dim sheet As Worksheet = workbook.Worksheets(0) Me.dataGridView1.DataSource = sheet.ExportDataTable