I'm reading an excel file from a C# app using ACE.OLEDB. Everything has worked fine so far until today I noticed that one of the column names is read incorrectly.
Here's what I've got in my excel file
Here's what I've got in my debugger
Basically the dot (".") is replaced with a hash ("#") for some reason.
The code is straightforward and works fine for the most part, don't think the problem is there, but will show it here just for the sake of clarity.
DataTable data = new DataTable();
string strAccessConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path.FullName + ";Extended Properties=\"Excel 12.0\";\"HDR=YES\";\"IMEX=1;\"";
OleDbConnection myAccessConn = new OleDbConnection(strAccessConn);
string strAccessSelect = "select * from [" + SheetName + "];";
OleDbCommand myAccessCommand = new OleDbCommand(strAccessSelect, myAccessConn);
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand);
myDataAdapter.Fill(0, maxRows, data);
Is there something I'm doing wrong or is it a bug in OLEDB?
I came here looking for a reference of column name transformations for special characters taken from header rows in Excel. Using SQL like this:
Here are the transformations I've seen:
This isn't a comprehensive list, but it may help someone. I've left the answer as a community wiki so that it can be freely edited.