Sunday, March 29, 2015

Read Excel File to String Question

Hi,


Use below code using OledDB.



string PATH = @"c:\MyCode\ExcelSheetName.xlsx";
string connection= "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + PATH + ";Extended Properties=Excel 12.0";

OleDbCommand cmd = new OleDbCommand("SELECT Column1 FROM [sheet1$] WHERE columnid=1 , connection);

string strValue = cmd.ExecuteScalar().ToString();





PS.Shakeer Hussain


No comments:

Post a Comment