protected function writeGoogleSheetTable(OutputInterface $output, \Google_Service_Sheets_Sheet $sheet)
    {
        $table = new Table($output);
        $merges = $sheet->getMerges(); /** @var \Google_Service_Sheets_GridRange[] $merges (the SDK type hint is incorrect) */

        foreach ($sheet->getData()[0]->getRowData() as $rowIndex => $sheetRow) {
            /** @var \Google_Service_Sheets_RowData $sheetRow */
            // TableSeparator is not used here because it is not compatible with rowspan

            $tableRow = [];

            foreach ($sheetRow->getValues() as $columnIndex => $sheetCell) {
                $colspan = $rowspan = 1;

                /** @var \Google_Service_Sheets_CellData $sheetCell (the SDK type hint is incorrect) */
                foreach ($merges as $merge) {
                    // The end indexes are not inclusive
                    if (
                        $columnIndex >= $merge->getStartColumnIndex() && $columnIndex < $merge->getEndColumnIndex() &&
                        $rowIndex >= $merge->getStartRowIndex() && $rowIndex < $merge->getEndRowIndex()
                    ) {
                        if ($columnIndex === $merge->getStartColumnIndex() && $rowIndex === $merge->getStartRowIndex()) {
                            $colspan = $merge->getEndColumnIndex() - $columnIndex;
                            $rowspan = $merge->getEndRowIndex() - $rowIndex;
                            break;
                        } else {
                            continue 2;
                        }
                    }
                }

                $tableRow[] = new TableCell((string)$sheetCell->getFormattedValue(), [
                    'colspan' => $colspan,
                    'rowspan' => $rowspan
                ]);
            }

            $table->addRow($tableRow);
        }

        $table->render();
    }