question

SurendraSingh-9225 avatar image
0 Votes"
SurendraSingh-9225 asked David-9140 Suspended answered

Import EXCEL data into Visual Studio 2019

Can any one suggest me where to look for VB code for importing data from EXCEL into Visual Studio 2019

dotnet-visual-basic
excelloaderror.jpg (41.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SurendraSingh-9225 ,
Also take a look at the following reference:
Best /Fastest way to read an Excel Sheet into a DataTable
Besides, if you need further assistance, please let me know.

0 Votes 0 ·
Castorix31 avatar image
0 Votes"
Castorix31 answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered karenpayneoregon commented

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.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I can't see anything for any of the links you posted. The message is,

This item might not exist or is no longer available.

0 Votes 0 ·

I've updated the links

1 Vote 1 ·
David-9140 avatar image
0 Votes"
David-9140 Suspended answered

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


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.