I am writing to an Excel file using OLEDB (C #). I only need the RAW data format.
I noticed that all cells (headers and values) have an apostrophe prefix (')
Is this a way to avoid adding them to all text cells?
Here is my connection string:
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=Yes'";
I tried using IMEX = 1 as follows:
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
But after that I get below error:
The Microsoft Jet database engine could not find the object 'C: \ Temp \ New Folder \ MF_2009_04_19_2008-11-182009_DMBHCSAM1118.xls'.
Make sure that the object exists, and you correctly name its name and path name.
Finally, I tried using IMEX = 0 as follows:
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=0\"";
There were no special comments this time.
Unfortunately, there is still a problem with apostrophes (so each of my values looks like this: '123,' abc, etc.)
Any idea?
Maciej
source share