ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i am trying to read excel files through c..
i ve stored the excel file as .csv file. my excel file has the data
data1 data2 data3
data4 data5 data6
i can read all the cell values as
data1,data2,data3,data4,data5,data6
but i want to select each and every cell values separately and to process over it. but i cant able to retrieve all the cell values. i can able to retrieve data1 alone by checking ,.
So, show us what you've written so far, and perhaps someone can offer some suggestions to help fix it. For parsing CSV data, you are going to need to make heavy use of string processing functions. strtok() is one that is probably useful, although it can be tripped up by commas embedded in quoted fields. It is almost impossible to suggest a general solution, unless someone knows of a canned library or source package for parsing such files, and it seems likely that such a package exists. I assume that you have a good reason for choosing a C implementation, rather than something like Perl, which makes such tasks almost trivial.
--- rod.
I don't see how paulsm4's code works for CSV files, either. It would seem to work fine for whitespace separated values. His point that C is the wrong tool for the job should be well taken however. My solution would probably involve something like Perl and the Text::CSV::Simple module. Since you haven't shown any actual data, nor have you given any indication how you wish to process the data, it is impossible to provide anything like a working example.
--- rod.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.