#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0

    Question how to load data from excel into C++ Application


    Hi Everyone,

    Can someone tell me how I can do the following or point me into the right direction, thanks in advance:

    I am trying to load data from an excel file into a grid/listview control in a Visual C++ 6.0 MFC exe application. The user should be able to edit the data and have the changes reflected in the excel file. However if possible, I do not want it to be necessary for user to have excel on their machine, b/c of this I want ot avoid OLE. I would also like to know what controls are best to display the excel data and/or what are the options.

    A link to a tutorial will be great, I've tried looking but all I find is tutorials for VB.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    You will need to have some way to access the excel spreadsheet, ODBC, DSN, DSN-less connection. From that point you will be able to `import` the excel data.
    ...
    Will the data entry point be excel? If not, you may consider exporting the excel spreadsheet to a csv or some other delimited file.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0

    Question


    Thanks for the advice.

    I am using odbc connection right now and my eventual goal is to have a data loaded from an excel spreadsheet into a listview/datagrid control. I want to be able to edit/delete/add data and have it reflected back in the excel spreadsheet. At the same time I want be able to change whole columns in the display control by loading data from an entirely different database(not necessarliy excel) afterwhich the changes would reflect in the excel file.

    Do you know if this is possible and if so, what is the best control and data connection to use (lisview or MS data grid; dao, odbc, ole?)
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    I am not a proponet for using MS Excel as a front end. Are there any issues with using MS Access, MySQL, Firebird or someother database management system?
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    All of my data is in excel sheets, also the future users of the system would want continue storing their data in excel spreadsheets.

    Why are you against excel?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    No I am not against Excel. As with everything, MS Excel is valuable. In using MS Excel to store data you could possibility encounter row limitations, lock contentions, enability to audit and secure data access, perform consistent backups or be able to restore to point in time and if the file becomes `too dense`, it may no longer function properly or be accessible. If this is production data taking preventive steps early on could save you a lot of time later.

IMN logo majestic logo threadwatch logo seochat tools logo