i am using the code below to select all of the data from a excel file and was wondering if it would be possible for me to start from row three and read in the rest of the data within the file..
excelConnectionString ="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFileName + ";Extended Properties=Excel 12.0";
// Create Connection to Excel Workbook
using (OleDbConnection excelConnection =
new OleDbConnection(excelConnectionString))
{
excelConnection.Open();
System.Data.DataTable dt = excelConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
string[] excelSheet = new String[dt.Rows.Count];
int sheet = 0;
foreach (DataRow row in dt.Rows)
{
excelSheet[sheet] = row["Table_Name"].ToString();
sheet++;
}
excelDataTable.Clear();
for (int i = 0; i < excelSheet.Length; i++)
{
OleDbCommand command = new OleDbCommand
("Select * FROM [" + excelSheet[i] + "]", excelConnection);
excelAdapter.SelectCommand = command;
excelAdapter.Fill(excelDataTable);
}
excelConnection.Close();
}
return excelDataTable;