I have this code which works fine and loads the excel data into an SQL table. The only problem is that it also inserts a new row with NULL values for all columns.
You could change your query to skip empty rows in excel:
"SELECT * FROM [" + Path.GetFileName(excelPath) + "] WHERE [Employee] IS NOT NULL"
This should avoid that empty rows are added to the DataTable
. Of course you could also remove them later but it would be less efficient. For example:
dtExcelData = dtExcelData.AsEnumerable()
.Where(r => !String.IsNullOrEmpty(r.Field<string>("Employee")))
.CopyToDataTable();