Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Is there any way to create a C program to read excel file?
Posted
Comments
Rick Shaub 6-Apr-11 11:50am    
Could you list the development environment and some information about the environment this program will run on? Information such as operating system, whether or not office is installed. Also, versioning information, i.e. Windows XP with Office 2007, etc.
rupeshkp728 6-Apr-11 15:01pm    
Thanks Rick for the reply.
Its C on Windows Vista/XP with Visual Studio 2005 and Office 2003 installed

Is there any way to create a C program to read excel file?
Yes!

Now, since you know it can be, we hope you will be back with an issue when you try to do the same.
 
Share this answer
 
Comments
rupeshkp728 6-Apr-11 15:00pm    
what is the way?
Albert Holguin 8-Apr-11 16:03pm    
you have to at least try to get people to want to help you
Try this: DispHelper[^]

Put a value into column 4 row 10:
MIDL
dhPutValue(xlSheet, L".Cells(%d,%d) = %s", 10, 4, szCellText);
 
Share this answer
 
v2
Excel exposes a COM API, so you could use that from C. But unelss your COM skills are exceptionally good, it will be a very difficult task. It would be far easier to do this from C++ or even C# (via interop).

[Edit]
-------

Guess what? Turns out Excel has a C API (no need to go the COM route).

See http://msdn.microsoft.com/en-us/library/bb687829.aspx[^]

[Edit 2]
---------

A quick read indicates that maybe it's more for writing faster functions, so it's probably not stand-alone. So while you can use that, you'd probably still need to use COM.
 
Share this answer
 
v3
Comments
Stephen Wiria 20-Apr-11 10:20am    
Nishant, have you checked the link i suggested before?
DispHelper helps C/C++ programmer to use COM object much more easily, while the MSDN link you gave only works with Excel 2010
Nish Nishant 20-Apr-11 10:22am    
Yeah, saw your link. I've never used that before. Thanks.

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