diff --git a/app/Jobs/ProcessCompanyDataJob.php b/app/Jobs/ProcessCompanyDataJob.php index f798029..658cf98 100644 --- a/app/Jobs/ProcessCompanyDataJob.php +++ b/app/Jobs/ProcessCompanyDataJob.php @@ -144,6 +144,12 @@ private function processRow(array $row, int $rowCount, string $filePath) : void { + // Exclude the last field from CSV + if (count($row) > 0) { + array_pop($row); + Log::info("Excluded last field from row $rowCount. New column count: " . count($row)); + } + $csvHeaders = array_keys(self::FIELD_MAP); if (count($csvHeaders) !== count($row)) { diff --git a/app/Jobs/ProcessDataCaptureDataJob.php b/app/Jobs/ProcessDataCaptureDataJob.php index 7efe010..b36f49e 100644 --- a/app/Jobs/ProcessDataCaptureDataJob.php +++ b/app/Jobs/ProcessDataCaptureDataJob.php @@ -185,6 +185,12 @@ private function processRow(array $row, int $rowCount, string $filePath) : void { + // Exclude the last field from CSV + if (count($row) > 0) { + array_pop($row); + Log::info("Excluded last field from row $rowCount. New column count: " . count($row)); + } + if (count(self::CSV_HEADERS) !== count($row)) { Log::warning("Row $rowCount in $filePath has incorrect column count. Expected: " . count(self::CSV_HEADERS) . ", Got: " . count($row));