Try this:
string connString = $"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={ txtSource.Text };Extended Properties=\"Excel 12.0;HDR=Yes;\";";
using(OleDbConnection connection = new OleDbConnection(connString))
{
connection.Open();
using(OleDbCommand command = new OleDbCommand("SELECT * FROM [Sheet1$];", connection))
{
}
}
I do not recommend to use
IMEX=1
, because it causes driver to treat data as text.
For further details about connection details, please see:
Excel connection strings - ConnectionStrings.com[
^]