Files
hqland-app/analyze_contracts.php
2026-04-24 08:58:53 +00:00

25 lines
780 B
PHP

<?php
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
function analyze($file) {
echo "--- ANALYZING: $file ---\n";
try {
$spreadsheet = IOFactory::load($file);
$worksheet = $spreadsheet->getActiveSheet();
$rows = $worksheet->toArray();
echo "HEADERS:\n";
if (isset($rows[0])) {
foreach ($rows[0] as $idx => $h) echo "Col $idx: " . ($h ?? "NULL") . "\n";
}
echo "SAMPLE DATA (Row 2):\n";
if (isset($rows[1])) echo implode(" | ", array_map(fn($v) => $v ?? "NULL", $rows[1])) . "\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
echo "\n";
}
analyze('storage/app/imports/Hd_kh.xlsx');
analyze('storage/app/imports/hopdong.xlsx');