How to read single Excel cell value

前端 未结 7 1944
情深已故
情深已故 2020-11-29 04:04

I have excel file with sheet1 that has a value I need to read on row 2 and column 10. Here is my code.

Excel.Workbook excelWorkbook = excelApp.Workbooks.Ope         


        
7条回答
  •  忘掉有多难
    2020-11-29 04:33

    Please try this. Maybe this could help you. It works for me.

    string sValue = (range.Cells[_row, _column] as Microsoft.Office.Interop.Excel.Range).Value2.ToString();
    //_row,_column your column & row number 
    //eg: string sValue = (sheet.Cells[i + 9, 12] as Microsoft.Office.Interop.Excel.Range).Value2.ToString();
    //sValue has your value
    

提交回复
热议问题