Pretty straight-forward import using SqlBulkCopy:
string excelConnectionString = @\"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" + filePath + \";Extended Pro
I used ODBC instead of the OLEDB and it doesn't truncate the values to 255 symbols anymore:
OdbcConnection con = new OdbcConnection(@"Driver={Microsoft Excel Driver
(*.xls)};DBQ=c:\temp\testbook.xls");
OdbcCommand cmd = new OdbcCommand(@"SELECT * FROM [Workbook1$]");
cmd.Connection = con;
OdbcDataAdapter da = new OdbcDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
you can use 2007 format driver to access XLSX files:
.... Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}
…