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 8934925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:53:03+00:00 2026-06-15T09:53:03+00:00

I am grabbing a value at a time and dynamically loading it into a

  • 0

I am grabbing a value at a time and dynamically loading it into a grid.

Is there a way to index a csv file to only look up a value at a certain row and column?
I can’t read all the rows as that would defeat the purpose of loading dynamically.

The CSV parser, Fast CSV Parser in my case, can grab a value like so csv[row][column]. When looking at the source, I noticed that it loops over everything in the file until it reaches the correct index column pair. To grab a value at row 100,000 column 80, it can take quite a long time.

Any help much appreciated.

  • 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-15T09:53:04+00:00Added an answer on June 15, 2026 at 9:53 am

    Well, you could do a fast first pass and store the offsets of each row. That would make subsequently locating a row much faster. If you have 80 columns but 100K rows, I’d focus on fast row-finding rather than fast column-finding.

    ETA: OK, I’m assuming your CSV file is on disk and that you can get exclusive access to it. Some of this code was based on this.

       List<int> offsets = new List<int>();
       using (StreamReader reader = new StreamReader("myfile.csv"))
       {
            int offset = 0;
            string line;
            while ((line = reader.ReadLine()) != null)
            {   
                offsets.Add(offset);             
                offset += (line.Length + 2);   // The 2 is for NewLine(\r\n)
            }
            offsets.Add(offset);  // pick up the last one
        }
    

    At the end of this, you will have the List variable offsets, which is indexed by line number and contains the offset to each line. You can then, when reading the file (when doing your grid-building) use offsets[n] to get the offset to Seek to (I’m assuming you’re using a FileStream or a StreamReader) and offsets[n+1] - offsets[n] to get the length.

    As far as parsing the returned line of text is concerned, I assume the CSV library you’re adapting has good logic for that.

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

Sidebar

Related Questions

I have a question about grabbing a certain value from the html response data
The following code is only grabbing the value of the last result in the
Grabbing album art for current song and using it to change a certain imageView.image
I'm grabbing lines from a text file and sifting line by line using regular
I have an element that I'm grabbing the value, thus: var text = form1.elements[i].value;
I am grabbing a JSON output into a NSDictionary, the JSON output looks somewhat
Originally I was using input with an id and grabbing it's value with getElementById.
I'm grabbing some data from a database that has a stored date value, and
I'm having issues figuring out where it's grabbing the default value. I tried changing
I'm trying to add a datetime into a database table by grabbing values from

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.