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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:33:40+00:00 2026-05-26T16:33:40+00:00

My C# application takes alot of data from an excel file and process it

  • 0

My C# application takes alot of data from an excel file and process it then write it back on the file.

The problem is when loading the data from the Excel file, it takes some time (30 seconds for about 7000 field of Excel)

I want to make it faster, is there’s any method to make it faster by significant amount of time?

The code I use to fetch the data is:

streamReader = new StreamReader(@"ExcelPath.txt");
string path = streamReader.ReadLine();

//An Excel Application ==(contains)==> [Many] Excel WorkBook ==(contains)==>[Many] Excel WorkSheets==(contains)==>[Many] Ranges
Microsoft.Office.Interop.Excel.Application excelapp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook myworkbook = excelapp.Workbooks.Open(path, 0, false, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true);

Microsoft.Office.Interop.Excel.Sheets myworksheets = myworkbook.Worksheets;
Microsoft.Office.Interop.Excel.Worksheet myworksheet =myworksheets.get_Item(1);
Microsoft.Office.Interop.Excel.Range range = myworksheet.UsedRange;

string[] data = new string[range.Rows.Count];
int start = 0;
for (start = 3; start < range.Rows.Count; start++)
{
    Microsoft.Office.Interop.Excel.Range myrange = myworksheet.get_Range("O" + start.ToString(), System.Reflection.Missing.Value);
    data[start] = myrange.Text;
    }
  • 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-05-26T16:33:40+00:00Added an answer on May 26, 2026 at 4:33 pm

    I have not done anything with Excel in a loooong time…but a few years ago we were able to speed up a few of our processes that read data from Excel reading ranges of cells at a time into an array (rather than going cell by cell).

    Each read operation from C# to Excel has to go through COM and that’s very expensive. If you manage to reduce how many times you need to read from Excel (e.g. by reading multiple values at once) you should see a significant improvement in speed.

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

Sidebar

Related Questions

Our application takes significantly more time to launch after a reboot (cold start) than
Our application takes text from a web form and sends it via email to
I have an application that takes the quality results for a manufacturing process and
I have an application which takes a string value of the form %programfiles%\directory\tool.exe from
I have an application that takes some input and generates configuration files as output.
I have a magazine application i want that it load file from server and
I have a C#-Application that stores data from a TextFile in a Dictionary-Object. The
I know there are a lot of questions on how to write data from
I have made an application that is receiving location data from a few web
I have a Python application that, to be brief, receives data from a remote

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.