1
votes

As the title states, the leading/trailing white space was trimmed after inserting data into excel file through Ace.OLEDB. Is there anyway to work around it? I want to insert some data into a excel file. The connection string is "Provider=Microsoft.Ace.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0;;Readonly=0;HDR=YES;IMEX=0;'". One column of the table is of type "MEMO", which I may add some text with leading/trailing white spaces, like " Hello ". But what I found is it become "Hello" after adding to the table.

1
You should try providing a more detailed explanation of exactly what you had, what you did and what happened. Details matter.jmcilhinney
Please add details about your actual query that inserts data into Excel. How are you storing the text in variables? This is important to answer your question.grovesNL
I have exactly the same problem. I have a query to insert row in an excel sheet like described and for a column, the value inserted is 'bla bla bla '. As you can see, there is a leading white space at the end of the string. The row is perfectly inserted but now when I go into the excel file and look at the value of the corresponding cell, the leading white space as been removed. Very strange.Samuel

1 Answers

0
votes

Try setting this option in connection string:

IMEX=1