Solved

Reading a Excel sheet

Posted on 2007-12-04
2
511 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

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.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

863 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

24 Experts available now in Live!

Get 1:1 Help Now