Click here to Skip to main content
15,895,813 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I am reading excelsheet in my project. But i'm getting automated conversion of some column names like "c# .Net" to "C# #Net".

I'm not getting what is exact problem.

Please do needful ASAP.

Regards.
Amol
Posted
Updated 17-May-15 20:09pm
v2
Comments
Arun Kumar_Tech 18-May-15 2:45am    
which dll you are using to read excel date?
Amol Lendave 18-May-15 5:52am    
For .xls "Microsoft.Jet.OLEDB.4.0"
and for .xlsx "Microsoft.ACE.OLEDB.12.0"

for .xls = Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"
and for .xlsx = Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1\"
Arun Kumar_Tech 18-May-15 6:06am    
Have you tried using this OLEDB Connectivity Code?

1 solution

In my point of view i think there is no solution for this, it will convert . to # by default, Better use Replace in column name to replace . to #.
 
Share this answer
 
Comments
VICK 18-May-15 5:19am    
A reference link would be better to prove your "Point of View" right.
Arun Kumar_Tech 18-May-15 5:22am    
many times i faced this issue, still now i didn't find any solution for this, only thing is to go with Replace. If you know solution means welcome share it.
Amol Lendave 18-May-15 6:00am    
It's not feasible to replace # to ., if my column name is "C# .Net" it will convert into "C# #Net".
After # to . replacement "C. .Net" not acceptable any more.
Amol Lendave 18-May-15 6:42am    
Mean while i have created some changes that works me.

Added
Extended Properties=\"Excel 12.0;HDR=No;IMEX=1\"
into connection string.

"HDR=No and IMEX=1" will avoid conversion of First row to Columns.

After that i have converted first row to columns and 2nd to nth rows as table Rows.

This is not proper solution. but it works me fine.
Arun Kumar_Tech 18-May-15 6:04am    
When you use Replace use Space before dot, so you won't get any conflict.
String str="C# .Net";
string RepStr=str.Replace(" ."," #");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900