Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7774133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:18:09+00:00 2026-06-01T17:18:09+00:00

I am working on reading data from excel sheet. My table will look like

  • 0

I am working on reading data from excel sheet. My table will look like this.

        AAAA            bbbbb              cccc
        1                2                  3
        4                5                  6
        --------------------------------------



        --------------------------------------

       data           data                  data

I want to loop though each and every row and save each value at each cell in a seperate string.

Here as per my table,

I want to store,

    string column1= 1;
    string cloumn2=2;
    string clomnn3= 3;

I want to repeat this for all rows. My excel will have only three columns.

I have tried this code

        //Reading Excel file
        string datafilename = @"D:\Book2.xls";
        string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + datafilename + ";" + "Extended Properties=Excel 12.0;"; 
        OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
        //fetching excel data into DataTable 
        System.Data.DataTable _dtDataFile = new System.Data.DataTable();
        ArrayList abcd = new ArrayList();
        myCommand.Fill(_dtDataFile);

        foreach (DataRow row in _dtDataFile.Rows)
        {
            Response.Write(row[i]);

        } 

The output i got is

    12346............datadatadata

I am getting all data in a single string, i want to store data in seperate strings for each row.

Can any one suggest, how to do this.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:18:11+00:00Added an answer on June 1, 2026 at 5:18 pm

    You’re getting all your data in one string because you’re writing it all straight to the response stream. You need to either add markup as Arion suggested, or actually add these values to some data structure. Also, have you thought about using the Excel Object Library? It might be a bit cleaner, plus you can iterate the native structure of the file directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

1) I have been working on fetching data from an excel sheet i can
I am working on an assignment that deals with reading data from a text
I am working on a project that requires reading text files, extracting data from
working with Flex4 AIR app, using this component I get data from the barcode
All, I'm exploring the feasibility of reading data from a local Excel file in
reading excel files from C# working well in 32 bit version server. It is
I'm working on an app that is reading it's data from a customized RSS
I am working on a ASP.NET/C# Website. I am reading data from a database,
I am working on a program that requires reading in integers from a file
I'm working on a program for class that reads data from a file, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.