Solved

Reading Excel in VB.NET

Posted on 2004-10-09
10
6,758 Views
Last Modified: 2009-02-06
how to import data from Excel in VB.NET?
0
Comment
Question by:rmkandan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
10 Comments
 
LVL 27

Accepted Solution

by:
Dabas earned 50 total points
ID: 12268340
Hi rmkandan:
In solution explorer, right click on your solution, Add Reference... COM, Microsoft Excel Object Library, Select, OK

Dabas
0
 

Author Comment

by:rmkandan
ID: 12268351
Dabas,
thanks, may i know what is the method to read the data from Excel Object Library?
0
 
LVL 27

Expert Comment

by:Dabas
ID: 12268363
rmkandan:
It depends what you want to do!

Here is an example

http:Q_20984271.html "Create Excel Spreadsheet from VB.Net"


Dabas
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rmkandan
ID: 12268595
i know how to create excel from VB.Net. But,i need to show the data from Excel to VB.Net
That is i need to retrieve data from a Excel SpeardSheet as Datasource and show the data
0
 
LVL 11

Expert Comment

by:pratap_r
ID: 12274524
create an ADO connection to the excel sheet, you can use it as you would a sql connection

heres the sample code, i am using oledb connection, so please import System.Data.OleDb in your code

        Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\query_Excel.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""")
        con.Open()
        Dim sq As New OleDbDataAdapter("select * from [query_Excel$]", con)
        Dim ds As New DataSet
        sq.Fill(ds)
        DataGrid1.DataSource = ds

enjoy!
pratap
0
 
LVL 11

Expert Comment

by:pratap_r
ID: 12696168
Dabas answered the question, and I clarified his point in my post. I guess the points should go to Dabas

Have Fun!
Pratap
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Simple Linear Regression

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question