Dear all,

How can i read a excel file as input, then select only some wanted coulums and rows for this file and again save it as excel file.

Hope to let help from you all.

Sincerely,
Monoj Sharma Luitel
BHUTAN

Microsoft .xls files are a proprietary file format, which means you need one of these options:

  • Write the program as a VBA macro within excel itself.
  • Pay Microsoft some money to get the appropriate SDK which would allow you to access .xls files in a meaningful manner.
  • Spend months / years reverse engineering the .xls file format, only for Microsoft to change it in some way with the next version of excel.
  • Grab the source code for open office. OpenOffice does a pretty good job of importing and exporting .xls files, so finding out how it does it may be worth while. This too would require a long period of research.

Or perhaps take an easier approach and get excel to save the file as a .csv file, which you then process to yield another .csv file for import back into excel. CSV files are just text files, which are very easy to process from a C program.

I believe the really new versions of excel also use XML as a text format for saving files, with the advantage that all the formatting information is also preserved as well. It too is easy to parse from a C program.

read this and this

commented: Some really nice info there +9
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.