Solved

Reading a Excel sheet

Posted on 2007-12-04
2
512 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
ID: 20407469
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
ID: 20418927
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

776 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