Thread: Read/Write a excel file using C program & OS is DOS

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    5

    Read/Write a excel file using C program & OS is DOS

    hello ,
    i want to accomplish the following tasks in c/c++ using DOS as OS.

    1. create an new excel file in runtime without opening the excel
    application

    2.reference any particular cell in a particular sheet of the workbook

    3. read / write into the chosen cell.

    what are the available options ?
    Could anyone provide me with a sample code... perhaps a single
    function which takes the filename & absolute cell reference as the
    parameters in addition to a read/write mode parameter along with the
    data item.

    thanking in anticipation...

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    It will be too difficult to do this in DOS....you can do it in windows via COM....and for this you will probably find it easier in C++

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>1. create an new excel file in runtime without opening the excel
    application<<

    Easy, use a CSV. Comma seperated volume ie cells are sperated by commas ','. Just save your text file as a .csv, use sprintf()


    >>2.reference any particular cell in a particular sheet of the workbook<<

    Not as easy.
    Have to count the new line characters to find the row and then the commas to find the column.
    Load the whole file into a char array and use pointers.

    >>3. read / write into the chosen cell.<<

    As a CSV is text and could have variable length in a cell, I would not modify the cell on the file but rewrite the whole file.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM