def check_workbook_exists(service, spreadsheet_id, tab_name):
    """
    Checks if the workbook exists within the spreadsheet.
    """
    try:
        spreadsheet = service.spreadsheets().get(
            spreadsheetId=spreadsheet_id).execute()
        sheets = spreadsheet['sheets']
        exists = [True for sheet in sheets if sheet['properties']
                  ['title'] == tab_name]
        return True if exists else False
    except Exception as e:
        print(f'Failed to check workbook {tab_name} for spreadsheet '
              f'{spreadsheet_id}')
        raise(e)