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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:39:24+00:00 2026-06-03T00:39:24+00:00

I am trying to build a simulation tool in Excel using VSTO and by

  • 0

I am trying to build a simulation tool in Excel using VSTO and by creating a Visual Studio 2010 Office workbook project. One of the worksheets in this workbook will contain approximately half a million records. Ideally I would like to read all of the records use them in the simulation and then output back some statistics. So far I had OutOfMemory exceptions when I tried to get the whole range and then the cells out of it in one go. Does anyone have other ideas as to how I can read all of the data or suggestions in doing this?

This is my code:

Excel.Range range = Globals.shData.Range["A2:AX500000"];

Array values = (Array)range.Cells.Value;

  • 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-03T00:39:25+00:00Added an answer on June 3, 2026 at 12:39 am

    How about fetching in batches, and assembling a slightly less memory heavy model in memory?

    var firstRow = 2;
    var lastRow = 500000;
    var batchSize = 5000;
    var batches = Enumerable
        .Range(0, (int)Math.Ceiling( (lastRow-firstRow) / (double)batchSize ))
        .Select(x => 
            string.Format(
                "A{0}:AX{1}",
                x * batchSize + firstRow,
                Math.Min((x+1) * batchSize + firstRow - 1, lastRow)))
        .Select(range => ((Array)Globals.shData.Range[range]).Cells.Value);
    
    foreach(var batch in batches)
    {
        foreach(var item in batch)
        {
            //reencode item into your own object collection.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a setup project in Visual Studio 2005, and it is
Background: I'm trying to build a web app (as a personal project using modern
I am trying to build some simulation software using makefile provided by them after
I'm trying build a method which returns the shortest path from one node to
Trying to build my project with ANT in idea 10 and I get a
Im trying to build call to action button on my site using jQuery. I
I am trying to build a web site in both English and Bulgarian using
I am trying to build a WPF application using the MVVM pattern. It would
I am trying to build a offline wiktionary using the wikimedia dump files (.xml.bz2)
I am trying to build a library in a legacy C++ project. Platform is

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.