Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
How to fetch cell by cell values from Excel to collection object in c#?

My current code over writes the cell values , while we iterate the cells in a foreach loop iteration.

int iGrpCount = 0;

public class MyGroup
public int RowIndex { get; set; } // Row Index
public int ColumnIndex { get; set; } // Column Index
public object ColumnValue { get; set; } // Column Value
public object SheetValue { get; set; } // Sheet Value

MyGroup objMgr = new MyGroup();
if (targetCell.RowIndex != templateRow.RowIndex)
objMyGrp[iGrpCount - 1].ColumnIndex = targetCell.ColumnIndex;
objMyGrp[iGrpCount - 1].ColumnValue = targetCell.Value.ToString();
objMyGrp[iGrpCount - 1].SheetValue = targetCell.ToString();

objMgr.RowIndex = targetCell.RowIndex;
objMgr.ColumnValue = targetCell.Value;

  • 3520
    Offline posted


    Please, explain in more details what exactly issue you are facing. If you are using the Excel Library, we suggest you refer to the documentation for details how to use it. If you cannot find information for your scenario, please send us a small sample application demonstrating the issue, so we can investigate it and provide a proper advice.