diff --git a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php
index b0e458f..1ee4fbc 100644
--- a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php
+++ b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php
@@ -213,7 +213,20 @@ EOD;
$cellXML .= ' s="' . $styleId . '"';
if ($cell->isString()) {
- $cellXML .= $this->getCellXMLFragmentForNonEmptyString($cell->getValue());
+ $matches = array();
+ if (preg_match('/=HYPERLINK\([\'"](.*)[\'"],\s*[\'"](.*)[\'"]\)/', $cell->getValue(), $matches)) {
+ if ($this->stringHelper->getStringLength($cell->getValue()) > self::MAX_CHARACTERS_PER_CELL) {
+ throw new InvalidArgumentException('Trying to add a value that exceeds the maximum number of characters allowed in a cell (32,767)');
+ }
+ // Special case to add HYPERLINK Formula
+ $url = $this->stringsEscaper->escape($matches[1]);
+ $text = $this->stringsEscaper->escape($matches[2]);
+ $formula = sprintf('HYPERLINK("%s","%s")', $url, $text);
+ $cellXML = sprintf(
+ '%s%s',
+ $columnIndex, $rowIndex, $formula, $text);
+ }else
+ $cellXML .= $this->getCellXMLFragmentForNonEmptyString($cell->getValue());
} elseif ($cell->isBoolean()) {
$cellXML .= ' t="b">' . (int) ($cell->getValue()) . '';
} elseif ($cell->isNumeric()) {