PHPOffice/PhpSpreadsheet · error · SpreadsheetException

Unable to bind unstringable object of type ' . get_class($va

Error message

Unable to bind unstringable object of type ' . get_class($value)

What it means

Error "Unable to bind unstringable object of type ' . get_class($value)" thrown in PHPOffice/PhpSpreadsheet.

Source

Thrown at src/PhpSpreadsheet/Cell/StringValueBinder.php:127

        return true;
    }

    protected function bindObjectValue(Cell $cell, object $value): bool
    {
        // Handle any objects that might be injected
        $ignoredErrors = false;
        if ($value instanceof DateTimeInterface) {
            $value = $value->format('Y-m-d H:i:s');
            $cell->setValueExplicit($value, DataType::TYPE_STRING);
        } elseif ($value instanceof RichText) {
            $cell->setValueExplicit($value, DataType::TYPE_INLINE);
            $ignoredErrors = is_numeric($value->getPlainText());
        } elseif ($value instanceof Stringable) {
            $cell->setValueExplicit((string) $value, DataType::TYPE_STRING);
            $ignoredErrors = is_numeric((string) $value);
        } else {
            throw new SpreadsheetException('Unable to bind unstringable object of type ' . get_class($value));
        }
        if ($this->setIgnoredErrors) {
            $cell->getIgnoredErrors()->setNumberStoredAsText($ignoredErrors);
        }

        return true;
    }
}

View on GitHub (pinned to 65b080eef4)

When it happens

Trigger: Thrown at src/PhpSpreadsheet/Cell/StringValueBinder.php:127 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/652a040819037424. Report an issue: GitHub.