Results 1 to 9 of 9

Thread: [RESOLVED] Parse Excel in ASP.NET

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    Resolved [RESOLVED] Parse Excel in ASP.NET

    Hi All,

    Any idea here how to parse excel files data in ASP.NET WebForms using C# or ASP.NET MVC using C#?

    Thank you

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Parse Excel in ASP.NET

    Hope this helps
    Please mark you thread resolved using the Thread Tools as shown

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Parse Excel in ASP.NET

    In addition to the above suggestion, you can look into using the Office Interop DLL's to read the excel file. This isn't a particularly "pretty" way of doing it, but depending on your requirements, you might need to do this.

    Here is an example:

    http://www.dotnetspider.com/resource...tas-using.aspx

    Gary

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    Re: Parse Excel in ASP.NET

    Thanks for the help, I will give you updates as soon as possible

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Parse Excel in ASP.NET

    jsc0624,

    Sounds like a plan, hope you get it working!

    Gary

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    Re: Parse Excel in ASP.NET

    I have successfully transferred the content of my excel files into dataset but the problem is:

    Code:
      foreach (DataRow row in objDataSet1.Tables[0].Rows)
                {
                    string name = row.Table.Rows[0]["FirstName"].ToString();
                    string last = row.Table.Rows[0]["LastName"].ToString();
                }
    Although it loops I can only extract the data of the first row.

    Thanks in advance.

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Parse Excel in ASP.NET

    Why are you going into another table in the row? Is this necessary?

    Gary

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    Re: Parse Excel in ASP.NET

    Hi Gary,

    You are right, I don't need to go to another table in the row. I change the code to this:

    Code:
                foreach (DataRow row in objDataSet1.Tables[0].Rows)
                {
                    string name = row.Field<string>("FirstName").ToString();
                    string last = row.Field<string>("LastName").ToString();
                }
    Thanks for the help guys!

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Parse Excel in ASP.NET

    Hey,

    Glad to hear that you got it working!

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width