LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   reading excel files in c language (http://www.linuxquestions.org/questions/programming-9/reading-excel-files-in-c-language-710921/)

MiniGopal 03-11-2009 11:55 PM

reading excel files in c language
 
hi friends...

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 ,.

can anyone help me over tat...

thanks in advance..

theNbomr 03-12-2009 12:21 PM

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.

MiniGopal 03-13-2009 12:53 AM

hi
 
thanks ya.......

i got it........

paulsm4 03-21-2009 02:50 PM

Hi -

Here's the real answer to your question:
Quote:

awk 'NR==1{print $3}' csvfile
http://www.linuxquestions.org/questi...0/#post3481680

MiniGopal 03-24-2009 04:26 AM

reading excel files in c
 
i am really sorry....

i cant able to get tis....

Quote:

awk 'NR==1{print $3}' csvfile

theNbomr 03-24-2009 10:09 AM

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.


All times are GMT -5. The time now is 11:03 AM.