I'm new to C#. I have used the code below to read data from Excel, but I need help modifying it to read key-value pairs.
public String getData(int row, int col, String var)
{
    Excel.Application excelApp = new Excel.Application();
    if (excelApp != null)
    {
        List<string> prop = new List<string>(var.Split(new string[] {"."}, StringSplitOptions.None));
        Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(@"D:\\test.xlsx", 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
        Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelWorkbook.Sheets[prop[0]];
        excelWorksheet.Select(Type.Missing);
        Excel.Range range = (excelWorksheet.Cells[row, col] as Excel.Range);
        string cellValue = range.Value.ToString();
        excelWorkbook.Close();
        excelApp.Quit();
        return cellValue;
    }
    return null;
}
 
     
    