use Win32::OLE;
$Win32::OLE::Warn = 3;

# ------ KONFIGURACJA SKRYPTU ------
$strExcelPath = 'd:\\data.xls';
$intStartRow = 2;
# ------ KONIEC KONFIGURACJI ---------
$objExcel = Win32::OLE->new('Excel.Application');
if (Win32::OLE::LastError()) {
    print "Excel nie jest zainstalowany.\n";
    exit 0;
}
$objExcel->WorkBooks->Open($strExcelPath);
$objSheet = $objExcel->ActiveWorkbook->Worksheets(1);
$intRow = $intStartRow;
while ($objSheet->Cells($intRow, 1)->Value ne '') {
    print "Wiersz $intRow\n";
    print 'Komrka 1: ' . $objSheet->Cells($intRow, 1)->Value, "\n";
    print 'Komrka 2: ' . $objSheet->Cells($intRow, 2)->Value, "\n";
    print 'Komrka 3: ' . $objSheet->Cells($intRow, 3)->Value, "\n";
    print 'Komrka 4: ' . $objSheet->Cells($intRow, 4)->Value, "\n";
    $intRow = $intRow + 1;
    print "\n";
}
$objExcel->ActiveWorkbook->Close();
$objExcel->Application->Quit();
print "Gotowe\n";

