diff --git a/src/PhpSpreadsheet/Writer/HTML.php b/src/PhpSpreadsheet/Writer/HTML.php
index 44eb5e02..5c87b3a4 100644
--- a/src/PhpSpreadsheet/Writer/HTML.php
+++ b/src/PhpSpreadsheet/Writer/HTML.php
@@ -405,7 +405,7 @@ class HTML extends BaseWriter implements IWriter
}
// Ensure that Spans have been calculated?
- if (!$this->spansAreCalculated) {
+ if ($this->sheetIndex !== null || !$this->spansAreCalculated) {
$this->calculateSpans();
}