I need to read a value from row 2 and column 10 in an excel file with sheet 1. This is my code.
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item(currentSheet);
var cell = (Excel.Range)excelWorksheet.Cells[10, 2];
I'm unable to read the contents of a cell after obtaining an Excel.Range cell object. I tried turning it into an array, looping through it, turning it into a string array, etc. It is undoubtedly pretty easy. Is there a straightforward way to retrieve a single string value from a cell?