Solved

Reading a Excel sheet

Posted on 2007-12-04
2
510 Views
Last Modified: 2008-02-01
have a excel file which starts with a report info in first few rows of excel and then table.

For example:

Distribution Report:

  No of employees:
Date:
Amount:


Detail Table

empno    ssn        aadr1   addr2

1. How can i skip rows till table headers and read just the data from table in database or dataset using asp.net

2. How can we handle dynamic sheet names [sheet1$]while reading xls files?
0
Comment
Question by:rahulsurya
2 Comments
 
LVL 21

Accepted Solution

by:
surajguptha earned 250 total points
Comment Utility
Check this out
http://blogs.vbcity.com/hotdog/archive/2006/01/12/5777.aspx

It has code to convert a excel sheet to a datatable. Once this is done you can remove the rows you dont want manually and then bind it to a grid...
0
 
LVL 28

Assisted Solution

by:iboutchkine
iboutchkine earned 250 total points
Comment Utility
you can read any cell you want. Just skip the header part

 Dim oExcel As Object
        Dim wbk As Object
        Dim a As String

        oExcel = CreateObject("Excel.Application")

        wbk = oExcel.Workbooks.Open(Filename:="c:\temp\a.xls", UpdateLinks:=False, ReadOnly:=False)
        With wbk.ActiveSheet
            'read
            a = .Range("A1").Value
        End With ' wbk
        wbk.Close()
        wbk = Nothing
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now