Daten aus einem Excelsheet lesen

include <ComObj.hpp> // include-Reihenfolge beachten!!!
include <utilcls.h> 

.
.
.

void __fastcall TForm1::LesenClick(TObject *Sender)
{
    if (OpenDialog1->Execute()) //*.xls-Dateinamen + Pfad angeben
    {
        try
        {
            Variant Excel;
            Excel = Variant::CreateObject("Excel.Application");
            Excel.OlePropertyGet("ActiveWorkBook");

            // Excel-Datei öffnen
            Excel.OlePropertyGet("WorkBooks").OleFunction("Open", OpenDialog1->FileName.c_str());

            //Excel.OlePropertySet("Visible", true); //Excel beim Arbeiten anzeigen, false = ausblenden

            Variant Sheet;
            Sheet=Excel.OlePropertyGet("ActiveSheet");
            AnsiString Zelleninhalt = Sheet.OlePropertyGet("Cells", 1, 1).OlePropertyGet("Value");// Zeile 1, Spalte 1 auslesen

            ShowMessage(Zelleninhalt);

            ShowMessage("Excel wird jetzt wieder geschlossen");

            Excel.OleFunction("Quit");
            Excel = Unassigned;
        }
        catch(...){}
    }
}

Daten in ein Excelsheet schreiben

include <ComObj.hpp> // include-Reihenfolge beachten!!!
include <utilcls.h> 

.
.
.

void __fastcall TForm1::SchreibenClick(TObject *Sender)
{
    Variant Excel;

    try
    {
        Excel = GetActiveOleObject("Excel.Application");
    }
    catch(...)
    {
        Excel = CreateOleObject("Excel.Application");
    }

    //Excel.OlePropertySet("Visible", true); //Excel beim Arbeiten anzeigen, false = ausblenden

    try
    {
        Variant WorkBooks = Excel.OlePropertyGet("WorkBooks");
        WorkBooks.OleFunction("Add");
        Variant ActiveWorkBook = Excel.OlePropertyGet("ActiveWorkbook");
        Variant WorkSheets = Excel.OlePropertyGet("Worksheets");
        Variant WorkSheet = WorkSheets.OlePropertyGet("Item", 1);
        WorkSheet.OleFunction("Activate");

        for (int iRow=0; iRow < 11; iRow++)
        {
            for (int iCol = 0; iCol < 11; iCol++)
            {
                Variant Range = WorkSheet.OlePropertyGet("Cells", iRow+1, iCol+1); // Row=.Zeile / Col=Spalte
                Range.OlePropertySet("Value", "TestText"+IntToStr(iCol)+IntToStr(iRow));
                Application->ProcessMessages();
            }
        }

        ActiveWorkBook.OleFunction("SaveAs", ".QueryResult.xls"); //Datei speichern
    }
    catch(...){}

    ShowMessage("Excel wird jetzt wieder geschlossen");

    Excel.OleFunction("Quit");
    Excel = Unassigned;
}