{"record":{"id":"feb811ce0d348842","repo":"PHPOffice/PhpSpreadsheet","slug":"the-table-name-cannot-be-longer-than-255-character","errorCode":null,"errorMessage":"The table name cannot be longer than 255 characters","messagePattern":"The table name cannot be longer than 255 characters","errorType":"exception","errorClass":"PhpOffice\\PhpSpreadsheet\\Exception","httpStatus":null,"severity":"error","filePath":"src/PhpSpreadsheet/Worksheet/Table.php","lineNumber":111,"sourceCode":"    {\n        return $this->name;\n    }\n\n    /**\n     * Set Table name.\n     *\n     * @throws PhpSpreadsheetException\n     */\n    public function setName(string $name): self\n    {\n        $name = trim($name);\n\n        if (!empty($name)) {\n            if (strlen($name) === 1 && in_array($name, ['C', 'c', 'R', 'r'])) {\n                throw new PhpSpreadsheetException('The table name is invalid');\n            }\n            if (StringHelper::countCharacters($name) > 255) {\n                throw new PhpSpreadsheetException('The table name cannot be longer than 255 characters');\n            }\n            // Check for A1 or R1C1 cell reference notation\n            if (\n                preg_match(Coordinate::A1_COORDINATE_REGEX, $name)\n                || preg_match('/^R\\[?\\-?[0-9]*\\]?C\\[?\\-?[0-9]*\\]?$/i', $name)\n            ) {\n                throw new PhpSpreadsheetException('The table name can\\'t be the same as a cell reference');\n            }\n            if (!preg_match('/^[\\p{L}_\\\\\\]/iu', $name)) {\n                throw new PhpSpreadsheetException('The table name must begin a name with a letter, an underscore character (_), or a backslash (\\)');\n            }\n            if (!preg_match('/^[\\p{L}_\\\\\\][\\p{L}\\p{M}0-9\\._]*$/iu', $name)) {\n                throw new PhpSpreadsheetException('The table name contains invalid characters');\n            }\n\n            $this->checkForDuplicateTableNames($name, $this->workSheet);\n            $this->updateStructuredReferences($name);\n        }","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/PHPOffice/PhpSpreadsheet/blob/65b080eef4d9fd11a5796135ab145883e5c3d6a6/src/PhpSpreadsheet/Worksheet/Table.php#L93-L129","documentation":"Error \"The table name cannot be longer than 255 characters\" thrown in PHPOffice/PhpSpreadsheet.","triggerScenarios":"Thrown at src/PhpSpreadsheet/Worksheet/Table.php:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"65b080eef4d9fd11a5796135ab145883e5c3d6a6","analyzedAt":"2026-08-17T05:40:41.646Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}