{"record":{"id":"94e066694151ff92","repo":"PHPOffice/PhpSpreadsheet","slug":"not-a-cell-range-address","errorCode":null,"errorMessage":"Not a cell range address","messagePattern":"Not a cell range address","errorType":"exception","errorClass":"PhpOffice\\PhpSpreadsheet\\Reader\\Exception","httpStatus":null,"severity":"error","filePath":"src/PhpSpreadsheet/Reader/Xls/Biff5.php","lineNumber":32,"sourceCode":"     * section 2.5.14.\n     */\n    public static function readBIFF5CellRangeAddressFixed(string $subData): string\n    {\n        // offset: 0; size: 2; index to first row\n        $fr = self::getUInt2d($subData, 0) + 1;\n\n        // offset: 2; size: 2; index to last row\n        $lr = self::getUInt2d($subData, 2) + 1;\n\n        // offset: 4; size: 1; index to first column\n        $fc = ord($subData[4]);\n\n        // offset: 5; size: 1; index to last column\n        $lc = ord($subData[5]);\n\n        // check values\n        if ($fr > $lr || $fc > $lc) {\n            throw new ReaderException('Not a cell range address');\n        }\n\n        // column index to letter\n        $fc = Coordinate::stringFromColumnIndex($fc + 1);\n        $lc = Coordinate::stringFromColumnIndex($lc + 1);\n\n        if ($fr == $lr && $fc == $lc) {\n            return \"$fc$fr\";\n        }\n\n        return \"$fc$fr:$lc$lr\";\n    }\n\n    /**\n     * Read BIFF5 cell range address list\n     * section 2.5.15.\n     *\n     * @return array{size: int, cellRangeAddresses: string[]}","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/PHPOffice/PhpSpreadsheet/blob/65b080eef4d9fd11a5796135ab145883e5c3d6a6/src/PhpSpreadsheet/Reader/Xls/Biff5.php#L14-L50","documentation":"While decoding a fixed 6-byte BIFF5 cell-range record (1-byte column fields, 2-byte row fields), first row > last row or first column > last column. Excel always stores ranges ordered, so an inverted range means the bytes are not really a range record (misaligned stream) or are corrupt.","triggerScenarios":"Reading an .xls where an earlier record had a wrong length so subsequent records are parsed at the wrong offsets; genuinely damaged range structures in BIFF5 (Excel 5/95) files; 0xFFFF sentinel values in deleted ranges.","commonSituations":"Excel 5/95-era files with unusual or corrupt internal structures; files from archaic exporters; uploads that were truncated or byte-mangled.","solutions":["Round-trip the file through Excel or LibreOffice (convert to .xlsx) so structures get rewritten cleanly","Verify the file opens in Excel; if not, treat it as corrupt and obtain a fresh export","If only values are needed, load with setReadDataOnly(true) so many range-bearing records are skipped"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $spreadsheet = IOFactory::load($path);\n} catch (\\PhpOffice\\PhpSpreadsheet\\Reader\\Exception $e) {\n    if (str_contains($e->getMessage(), 'Not a cell range address')) {\n        // convert via LibreOffice to rebuild range records, then retry\n    }\n}","preventionTips":["Normalize legacy BIFF5 files through conversion before parsing","Verify uploads open in Excel as an acceptance test","Use setReadDataOnly(true) when range-bearing metadata is irrelevant"],"tags":["xls","biff5","cell-range","phpspreadsheet"],"backgroundTag":"corrupt-biff-record","analyzedSha":"65b080eef4d9fd11a5796135ab145883e5c3d6a6","analyzedAt":"2026-08-17T05:40:41.646Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}