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

  • Home
  • SEARCH
  • 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 8479459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:01:54+00:00 2026-06-10T19:01:54+00:00

I have this bit of code that I use to read a sheet from

  • 0

I have this bit of code that I use to read a sheet from a excel workbook and then populate a list.

I’m getting a range, putting it into a two-dimensional array and then going through it with a for cycle and populating the list.

My question is, is there a better way to achieve the same result? I mean, with less code and faster.
I have to do this for 4 sheets and it takes 260ms.

public static void LoadDdrDataIntoObjects(ref List<Receivables> recList, ref List<Dilution> dilList, ref List<Accountable> accList, ref List<Outstanding> outList, string sheet)
{
    Workbook pantaReiWorkBook = PantaReiApplication.ActiveWorkbook;
    Sheets pantaReiWorkSheets = pantaReiWorkBook.Sheets;

    Worksheet pantaReiWorkSheet = pantaReiWorkSheets[sheet];
    Range pantaReiLastCell =
        pantaReiWorkSheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell);

    Range pantaReiRange =
        pantaReiWorkSheet.Range["A1:" + pantaReiLastCell.Address.Trim(new char['$']), Type.Missing];

    object[,] pantaReidataRange = (object[,]) pantaReiRange.Value[Type.Missing];

    for (var row = 2; row <= pantaReidataRange.GetLength(0); row++)
    {
        Receivables pantaReiReceivable = new Receivables
        {
            FileID = fileID.ID,
            SheetType =
                pantaReidataRange[row, 1].ToString(),
            SellerCompany =
                pantaReidataRange[row, 2].ToString(),
            Contract = pantaReidataRange[row, 3].ToString(),
            DebitID = pantaReidataRange[row, 4].ToString(),
            CompanyCode =
                pantaReidataRange[row, 5].ToString(),
            NoteNumber =
                pantaReidataRange[row, 6].ToString(),
            Installment =
                Convert.ToInt32(pantaReidataRange[row, 7]),
            InvoiceDate =
                (DateTime) pantaReidataRange[row, 8],
            DueDate1 = (DateTime) pantaReidataRange[row, 9],
            DueDate2 =
                (DateTime) pantaReidataRange[row, 10],
            DueDate3 =
                (DateTime) pantaReidataRange[row, 11],
            Currency =
                pantaReidataRange[row, 12].ToString(),
            Amount =
                (float)
                Convert.ToDouble(pantaReidataRange[row, 13]),
            Sign = pantaReidataRange[row, 14].ToString(),
            ProductType =
                pantaReidataRange[row, 15].ToString(),
            DilutionType =
                Convert.ToString(pantaReidataRange[row, 16]),
            MaturityStatus =
                Convert.ToInt32(pantaReidataRange[row, 17]),
            DebitStatus =
                pantaReidataRange[row, 18].ToString(),
            DealerFlag =
                pantaReidataRange[row, 19].ToString(),
            CustomerDescription =
                pantaReidataRange[row, 20].ToString(),
            AssetType =
                Convert.ToInt32(pantaReidataRange[row, 21])
        };

        recList.Add(pantaReiReceivable);
    }
}
  • 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-10T19:01:55+00:00Added an answer on June 10, 2026 at 7:01 pm

    I managed on my own. I used reflection.

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

Sidebar

Related Questions

I use this bit of code to feed some data i have parsed from
I have a bit of sample code that is throwing this warning: main.c: In
I have this bit of code, public static List<string> GetSentencesFromWords(List<string> words, string fileContents) {
I have the following bit of code that reads data from the an Oracle
I have a small piece of code that requires to read 4-bit values bitpacked
I have this bit of code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
i have this bit of code, it limits the Li's to 15 of them
So I have this bit of code for x in range(x1,x2): for y in
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
its a little bit hard to understand. in the header.php i have this code:

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.