def apply_to_sheet(self, worksheet: gspread.Worksheet):
        """
        Remove the row corresponding to this update's deleted message from
        the specified Google Sheet worksheet.
        """
        # Find existing cell with the same ID
        try:
            cell = worksheet.find(self.message_id)
        except gspread.CellNotFound:
            logger.error(f"Failed to delete message with id={self.message_id} - original message not found in sheet.")
            return

        if not cell.col == ColumnHeaders['MessageID'].value:
            logger.error(f"Failed to delete message with id={self.message_id} - no message with same ID found.")
            return

        worksheet.delete_row(cell.row)
        # Prints Success message to console
        logger.info(f"Successfully deleted message with id={self.message_id}.")
def _ensure_sheet_formatting(worksheet: gspread.Worksheet):
    """
    Ensure that the specified worksheet has the correct header row.

    Overwrites the header row if a header mismatch is found.
    """
    worksheet_headers = list(worksheet.row_values(1))
    expected_headers = list(ColumnHeaders.__members__.keys())

    # Check if the current_headers line up with the updated header structure
    if worksheet_headers != expected_headers:
        logger.warning("Prexisting table, with improper formatting: Fixing")
        # TODO: move all data, not just headers
        worksheet.delete_row(1)
        worksheet.insert_row(expected_headers, 1)
    else:
        # TODO: ensure the below is still necessary
        if worksheet.row_count in (0, 1):
            worksheet.insert_row([], 1)
            worksheet.insert_row(expected_headers, 1)
            worksheet.delete_row(3)
        worksheet.delete_row(1)