Saturday, April 9, 2016

Get Microsoft Excel cell value using C#

In this article, I'll show you two options to get the cell value of excel using C#. Given that you are using VSTO and have referenced the assembly Microsoft.Office.Interop.Excel.

1
2
3
var cellValue = (string)(xlWorkSheet.Cells[3, 6] as Excel.Range).Value2;
//or this
var cellValue = xlWorkSheet.get_Range("F3", Type.Missing).Value2;

Note: xlWorkSheet is an Excel Worksheet object.

0 comments:

Post a Comment