I have excel file with screenshot inside excel..
Now i need to read this screenshot from excel and store into datatable...
How is this possible.
if each row of excel has values in cell ,following code will be helpful..
if has screenshot,how to store in datatable
string HDR = hasHeaders ? "Yes" : "No";
string path = FileName;
DataSet output = new DataSet();
string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;";
using (OleDbConnection conn = new OleDbConnection(strConn))
{
conn.Open();
System.Data.DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
foreach (DataRow row in dt.Rows)
{
string sheet = row["TABLE_NAME"].ToString();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [" + sheet + "]", conn);
cmd.CommandType = CommandType.Text;
System.Data.DataTable outputTable = new System.Data.DataTable(sheet);
output.Tables.Add(outputTable);
new OleDbDataAdapter(cmd).Fill(outputTable);
}
}
return output.Tables[0];