<?php
$zip = new ZipArchive();
if ($zip->open(__DIR__ . "/../R6 BOM.xlsx") === TRUE) {
    $sharedStringsRaw = $zip->getFromName('xl/sharedStrings.xml');
    $strings = [];
    if ($sharedStringsRaw) {
        $xml = simplexml_load_string($sharedStringsRaw);
        foreach ($xml->si as $si) {
            $t = '';
            if (isset($si->t)) $t = (string)$si->t;
            elseif (isset($si->r)) foreach ($si->r as $r) $t .= (string)$r->t;
            $strings[] = $t;
        }
    }
    
    $sheetRaw = $zip->getFromName('xl/worksheets/sheet1.xml');
    $xml = simplexml_load_string($sheetRaw);
    $rows = 0;
    foreach ($xml->sheetData->row as $row) {
        $rowData = [];
        foreach ($row->c as $c) {
            $val = (string)$c->v;
            if (isset($c['t']) && $c['t'] == 's') {
                $val = $strings[(int)$val];
            }
            $rowData[] = $val;
        }
        echo implode(" | ", $rowData) . "\n";
        $rows++;
        if ($rows > 5) break;
    }
    $zip->close();
}

