C# Import Excel to DataSet

I use

var selectCmd = "SELECT * FROM [" + excelSheetName + "]";

The connection string With Extention of:

Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + absPath + fName + ";Extended Properties='Excel 8.0;HDR=No;IMEX=1'"

It works perfectly.

The problem is when the first column in the Excel is empty it brings in the other columns but in shift of 1. Meaning column B that was full and is numbered 1 becomes column number 0.

Is there a way to overcome this behaviour so that the select will import the first column that is empty. So that my imported column will be as the excel file?

Thanks for any response.

0 answers