#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    73
    Rep Power
    12

    reading an excel spreadsheet


    is it possible to read data from an excel spread sheet in C++?
    I need to read data from a spread sheet and analyze the data.

    thanks
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    I know there are ways (I used to write data to spreadsheets all the time, but never read from one), but how often are you going to be doing this? If it is only once, I suggest you save the data in tab or comma delimited format and process it that way. It is very inefficient to read/write data into/out of out-of-process objects.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    73
    Rep Power
    12
    It is actually a large data file that i wil be getting from someone else.

    Anyway how do we write data to a excel sheet. i think i will be asked to output data to excel spread sheet.

    thank you
  6. #4
  7. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    The code I used for that was in VB, so I don't expect it to be very valuable in this forum. I imagin there are examples on the web, but the biggest problem I ever had was in finding documentation for the calls (actually, I never did find any documentation).

    As an aside, I believe you can create an ODBC link to an Excel spreadsheet, you may want to look at that idea also.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  8. #5
  9. No Profile Picture
    Offensive Member
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2002
    Location
    in the perfect world
    Posts
    622
    Rep Power
    27
    The easiest way is .csv files. these are excel files where the cells are seperated by commas. Can be viewed in notepad or excel.


    Not good for complex formulars....

    >>I believe you can create an ODBC link to an Excel spreadsheet

    This is the easiest way to go if .csv files are not complex enough (AFAIK) but will require the PC to have a DSN or FILE DSN added.

    Look at the MFC CRecordSet class if you have a standard sheet.
    The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

    Frank Zappa

IMN logo majestic logo threadwatch logo seochat tools logo