Skip to content

Commit

Permalink
Catch exception if first excel sheet does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
sprain authored May 23, 2024
1 parent 4c80797 commit 78e8e12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/HtmlPhpExcel/HtmlPhpExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ private function parseHtml(): void

private function createExcel(): void
{
// Remove 1st sheet created automatically with new excel
$this->excel->removeSheet(1);
// Remove 1st sheet, which might be created automatically with new excel
try {
$this->excel->removeSheet(1);
} catch (\Exception) {}

// Loop over all tables in document
foreach($this->document->getTables() as $table) {
Expand Down

0 comments on commit 78e8e12

Please sign in to comment.