Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
How do I fetch data of particular cell of excel file? I don't have any idea about this. also tell me how do I establish connection between mfc and excel file.
Thank you very much in advance.
Posted
Comments
[no name] 27-Apr-11 5:22am    
Hey can you convert xls into csv file to read write. because reading .csv file is much easy than .xls.but if no then i have one solution

This link may help you
Reading Excel files using ODBC in mfc[^]
this link provide you a project of code if you have any doubt then reply
 
Share this answer
 
Comments
virus131 27-Apr-11 5:40am    
Thanks a lot for your reply. I've already tried this one. but there is 1 problem- whenever user changes excel file, each time it needs to define a new table for the updated data & again need to change table name in sql statement of program also. this is not user friendly approach. Please help me if possible.
Thanks again.
[no name] 27-Apr-11 5:51am    
Then Take excel file name from user
like
FileName="MyExel.xls";
sSql = "SELECT * FROM "
+FileName+
"ORDER BY field_1";

In give project link
virus131 27-Apr-11 6:09am    
no, it's not working. It still needs to name a section of data in the excel sheet using "Insert->Names" which I don't want to do. Please suggest another solution.
virus131 27-Apr-11 6:24am    
Hey, Its done by using-
sSql = "SELECT * FROM [sheet1$]"
"ORDER BY field_1";
[no name] 27-Apr-11 7:32am    
Thats nice some time we have solutions but we doesn't identify it.
It's all described in this Codeproject: Fetching Data from Microsoft Excel using SQL[^]

Good luck!
 
Share this answer
 
Comments
virus131 27-Apr-11 5:10am    
Thanks for replying. But I need solution in mfc.

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