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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:13:20+00:00 2026-05-27T04:13:20+00:00

I have an Excel file from which I have to extract the required data

  • 0

I have an Excel file from which I have to extract the required data and save it to a database. I know by using Range we can get a particular range of data. But my data that was to be extracted was a bit large. So can anyone suggest which was the best and simple method to retrieve the data and store the information in a database?

I would like to read the data from A10 to an unknown range. My data will be as follows

enter image description here

As per marked with red after that data should go in to the database column by column I will do that if anyone can suggest the best method to read the remaining columns too.

  • 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-27T04:13:20+00:00Added an answer on May 27, 2026 at 4:13 am

    If you still need to do it from code there is only one way of doing. As per your question you said that your data will start from A10, first of all get the UsedRange of excel as follows

    Microsoft.Office.Interop.Excel.Range xlRange = worksheet.UsedRange;
    

    As there are only 2 columns get the row count and column count of excel ad follows

    iRows = xlRange.Rows.Count;
    iCols = xlRange.Columns.Count;
    

    Later start your loop as follows

    for (int iRow = 10; iRow <= iRows; iRow++)
     {
       for (int iCol = 1; iCol <= iCols; iCol++)
       {
          xlRange = (Microsoft.Office.Interop.Excel.Range)worksheet.Cells[iRow, iCol];
          Console.WriteLine(xlRange.Text); // From here do as per you required and insert the required data to the data base. 
          List<string> lstItems = new List<string>(); // Declare this initially 
           lstItems.Add(xlRange.Text.ToString());
           if (lstItems.Count == 10)
           {
             if (xlRange.Text.ToString().Contains("www") || lstItems[9].ToString() == string.Empty)
             {
             }
          }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel file (which has data imported from Oracle 10G Database) one
I have written an Excel VBA macro which imports data from a HTML file
I have data from an excel file which contains one column as DateTime with
I have developed a VB.Net code for retrieving data from excel file .I load
I have got the following code from here to read an Excel file using
I have a table in C#, the data is coming from an Excel file.
I have an excel file which has more than 65536 rows. However, I can
Do we have any open source tool which allow generation of excel file from
i have an excel file which describe all the table structure of a database
Ok - I have a WCF Service which reads an excel file from a

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.