Reading xls files

Hello everyone! I ran into another problem. So I have this excel spreadsheet that has like many many names and many scores on projects (school stuff). My OBJECTIVE: Find the highest score on each project and print the name of the person. PROBLEMS: Some names also have two strings in them, like "Mc Donald" or "Adaji Ruvvali", etc.

Code:

FILE *fp;
fp=fopen(projectscores.xls, r);

So after I read the xls, how do I make it read the columns, there are total of 8 columns, One for the names, and 7 for the 7 projects. I was thinking of just going through the excel file and just saying finding the highest score on each project, but I was wondering if I can write code for this, so here we are ...

I read the tutorial on the cprogramming website, but it doesn't talk about reading xls columns and rows. If you guys have the time to give me your advice and help , it will be greatly appreciated.

Here is a 250 page document explaining the format: http://sc.openoffice.org/excelfileformat.pdf. Of course there may be libraries that do this for you, but it's still going to be more difficult than using the csv approach.

Well I just like coding, its fun and it takes other stress off of me. Just trying things with coding and stuff, see how far I can go and stuff, but it seems like everything I try, i always hit a wall. lol.

hey would this work? like so... ahh here's what I got so far, I was just wondering if it would work

Code:

typedef struct
{
char names[50];
int scores[10];
}PEOPLE;

Then after this struct, I just make a few declaration functions, like one of them would get make sure the file name is correct, the other would maybe read the file into an array or something that can hold it and malloc some memory, then like finally make a function that will get the highest score? It might a lot of work, but its going to be fun

You are making a very large assumption -- that if the spreadsheet has "McDonald" in it, the file also has McDonald in it somewhere. If that was true, you wouldn't need a 250 page description of how to read the data.

Here is a 250 page document explaining the format: http://sc.openoffice.org/excelfileformat.pdf. Of course there may be libraries that do this for you, but it's still going to be more difficult than using the csv approach.

BTW, Why do this in C? You can do it in Excel pretty easily...

Nice! Do you happen to have one on Power Point Format? You would be my personal hero if you did.

Sorry I was gone for a bit. Hmm so, is there no way to read my xls file or something?

Yes, there is, but just like you CAN build your own car from a few lumps of aluminium and some plate steel (and many other bits and pieces, most likely), it's much easier to achieve the goal in a different way: Save the .xls as .csv in Excel, then read that file - which is a relatively easy to read text-file, rather than a complex binary file.

The document from MS: http://download.microsoft.com/downlo...cification.pdf
is 349 pages long, and whilst MANY of those pages aren't necessary for what you want to do [you probably don't care about formatting options, comments on fields, revision records, etc, etc], I bet that unless someone who is REALLY experienced in this sort of thing is working on it, it will be months before you complete your project.

--
Mats

Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.

Here is my code at the moment, I was just thinking of a way for a while to do this... its quite long, but basically my comments are the things where it explains everything. I'll still be working on this , its fun. Cprogramming tutorials are awesome, but there are still questions that i have, especially about the fscan thingy...