Solved

Reading Excel in VB.NET

Posted on 2004-10-09
10
6,756 Views
Last Modified: 2009-02-06
how to import data from Excel in VB.NET?
0
Comment
Question by:rmkandan
  • 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
 

Expert Comment

by:aganapathy
ID: 12980804
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

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

713 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