C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ADO.NET »

Read Data From Excel sheet using Excel.Application Object


Posted Date: 18 Sep 2009    Resource Type: Code Snippets    Category: ADO.NET
Author: krishna kumariMember Level: Silver    
Rating: 1 out of 5Points: 7



Read Data From Excel sheet using Excel.Application Object



Read Data from excel we can use odbe connection string. if that excel sheet is protected by password.Even through if know the password also you cann't connect to it by using odbe or oledb connection strings.

we can overcome this by using Excel.Application object which is present in microsoft excel 11.0 object library(com componect)

VB code:

First add reference->Com->Microsoft Excel 11.0 Object Library.

Dim xlapp As New Excel.Appication
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
wb=xlapp.Workbooks.Open(yourexcelfilepath,,,,password)
ws=wb.Sheets("sheet1")
ws.Cells(0,0)//to display perticular cell value
ws.rows.count//to find row count,
ws.columns.count//to find columns count.
xlapp.Visible=True



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
"Reading excel file"  .  "Microsoft excel obect library"  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Copy DataRow from one table to another table
Previous Resource: SQL Bulk Copy
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use