I am trying to open an Excel file located on my local computer and take out a few values from it. The values are a mix of strings and numbers located in different cells. The Excel file will be opened using openFileDialog. I am using C# and developing a desktop application (WPF). This is the code I am implementing:
Excel.Application excelApp = new Excel.Application();
string workbookPath = "C:/Users/b_prashanth/Documents/26. Workload Modeling generic template.xlsx";
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item(currentSheet);
Excel.Range excelCell =
(Excel.Range)excelWorksheet.get_Range("A1", "A1");