The Microsoft Office Access database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.
What I have tried:
protected void Button1_Click(object sender, EventArgs e)
{
String strConnection = @"Data Source=PARAMERP4-PC\SPEEDPEQ;Initial Catalog=XYZ;Integrated Security=True";
//file upload path
string path = FileUpload12.PostedFile.FileName;
//Create connection string to Excel work book
string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;Persist Security Info=False";
//Create Connection to Excel work book
OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
//Create OleDbCommand to fetch data from Excel
OleDbCommand cmd = new OleDbCommand("Select [CLIENT],[TASK],[DESCRIPTION],[DATE],[TIME TAKEN],[CALL ATTENDED BY],[ISSUE RESOLVED BY],[Help By] from [Sheet1$]", excelConnection);
excelConnection.Open();
OleDbDataReader dReader;
dReader = cmd.ExecuteReader();
SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection);
//Give your Destination table name
sqlBulk.DestinationTableName = "Export_Excell_Sheet";
sqlBulk.WriteToServer(dReader);
excelConnection.Close();
}
Excell collumn name :----CLIENT TASK, DESCRIPTION, DATE, TIME TAKEN, CALL, ATTENDED BY, ISSUE RESOLVED BY, Help By
Data Base Column name :--tbale name -Export_Excell_Sheet
[Export_Excell_Sheet]
(
[CLIENT] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TASK] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DESCRIPTION] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DATE] [datetime] NULL,
[TIME_TAKEN] [datetime] NULL,
[CALL_ATTENDED_BY] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ISSUE_RESOLVED_BY] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Help_By] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
)