Thread: Exporting to spreadsheet (excel or other)

  1. #1
    Registered User
    Join Date
    Jul 2004

    Exporting to spreadsheet (excel or other)

    I have already made a program that exports some information to Access database using ODBC and SQL, and I was wondering if there is a similar thing for spreadsheets and if so where I can get information on it


  2. #2
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    If your using C as far as I know there isn't anyting to interface with Excel. If you want to do that you'll have to learn COM and take it from there. Or you might try manipulating a CSV file. search the board Or pm me for more info.
    Warning: Opinions subject to change without notice

    The C Library Reference Guide
    Understand the fundamentals
    Then have some more fun

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    You can use ODBC/SQL with Excel, very similar to the way you use it with Access. You just have to alter your connection string and SQL statements. Here is a C sample that demonstrates reading and writing to Excel using the windows ODBC API. You can use whatever ODBC API you are comfortable with.

    Treating Excel as a database does not let you set formatting, etc. To do that you can have a look at this sample that demonstrates the binary manipulation of an Excel file or you can use the COM interfaces that Excel provides.

    To use the COM interfaces you can use MFC or have a look at other COM helper libraries such as DispHelper, especially the Excel sample(also available in C++).

    As mentioned, if you just want to export spreadsheet values, you should look into using a comma seperated values(csv) file. These are compatible with most spreadsheet software.
    Last edited by anonytmouse; 07-28-2004 at 11:28 PM.

  4. #4
    Registered User
    Join Date
    Jul 2004

    csv file

    I think that's going to be enough for me in this situation. I was kindof leary about the whole ODBC thing anyways (took me forever to get it perfect last time)

    Thanks a lot! (I haven't actually got it running yet, but I'm confident...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dissecting an Excel XML spreadsheet
    By desmond5 in forum C++ Programming
    Replies: 1
    Last Post: 05-22-2008, 04:32 PM
  2. Replies: 2
    Last Post: 11-30-2006, 08:04 AM
  3. Replies: 1
    Last Post: 05-05-2006, 11:17 PM
  4. Exporting a DataTable to Excel (.NET)
    By Trauts in forum C# Programming
    Replies: 0
    Last Post: 07-29-2005, 01:03 PM
  5. Is it possible to write into an Excel spreadsheet?
    By rtsc17 in forum C++ Programming
    Replies: 6
    Last Post: 09-18-2003, 10:15 AM