PHPOffice/PhpSpreadsheet · error · SpreadsheetException
unusable type $gettype
Error message
unusable type $gettype
What it means
Error "unusable type $gettype" thrown in PHPOffice/PhpSpreadsheet.
Source
Thrown at src/PhpSpreadsheet/Cell/DefaultValueBinder.php:86
if (is_bool($value)) {
return DataType::TYPE_BOOL;
}
if ($value === '') {
return DataType::TYPE_STRING;
}
if ($value instanceof RichText) {
return DataType::TYPE_INLINE;
}
if ($value instanceof BaseDrawing) {
return DataType::TYPE_DRAWING_IN_CELL;
}
if ($value instanceof Stringable) {
$value = (string) $value;
}
if (!is_string($value)) {
$gettype = is_object($value) ? get_class($value) : gettype($value);
throw new SpreadsheetException("unusable type $gettype");
}
if (strlen($value) > 1 && $value[0] === '=') {
$calculation = CalculationParserOnly::getParserInstance();
try {
if (empty($calculation->parseFormula($value))) {
return DataType::TYPE_STRING;
}
} catch (CalculationException $e) {
$message = $e->getMessage();
if (
$message === 'Formula Error: An unexpected error occurred'
|| str_contains($message, 'has no operands')
) {
return DataType::TYPE_STRING;
}
}
View on GitHub (pinned to 65b080eef4)
When it happens
Trigger: Thrown at src/PhpSpreadsheet/Cell/DefaultValueBinder.php:86 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of PHPOffice/PhpSpreadsheet@65b080eef4 (2026-08-17).
Data as JSON: /api/errors/a777762fb85e9010.
Report an issue: GitHub.