There is an old article here:
Creating Excel Sheets using ODBC[
^]. It uses the MFC
CDatabase
class to write Excel files using ODBC.
I prefer using ADO (OLE DB) instead of ODBC. It allows passing data by values rather than by text which is especially useful with floating point values to avoid rounding errors. This does not require MFC but is more complex than using SQL commands only as with ODBC. Article:
How to Read and Write Excel Files in C++ via ADO[
^].
As an alternative you may create a CSV, TAB separated text, or HTML file. All these formats can be loaded by Excel.