How to access a cell in Excel worksheet using C#

Total Post:117

Points:821
C# 
C#
 1328  View(s)
Ratings:
Rate this:

I want to access a cell in Excel worksheet using C#. I tried to use the followed code:

if (xlWorksheet.Cells[k + 5, 0] ==
Convert.ToString(ent.Cells[i, 3].Value))
{
     p = k;
}

But its not working.

Any help will be appreciated.

  1. Post:145

    Points:1019
    Re: How to access a cell in Excel worksheet using C#

    Hi Jay,


    Try the below code:-

    if (xlWorksheet.Cells[k + 5, 0].Text ==
    Convert.ToString(ent.Cells[i, 3].Value  
    ))
       {
         p = k;
       }

    Hope this will solve your problem.

      Modified On Apr-03-2018 05:50:29 AM

Answer