Solved

Reading a Excel sheet

Posted on 2007-12-04
2
515 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

691 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