Skip to content

HttpError returned by Google Sheets#953

Merged
ebattat merged 2 commits into
redhat-performance:mainfrom
pragya811:gsheet-error
Nov 25, 2025
Merged

HttpError returned by Google Sheets#953
ebattat merged 2 commits into
redhat-performance:mainfrom
pragya811:gsheet-error

Conversation

@pragya811

@pragya811 pragya811 commented Nov 24, 2025

Copy link
Copy Markdown
Member

Type of change

Note: Fill x in []

  • bug
  • enhancement
  • documentation
  • dependencies

Description

Getting a 400 Http Error in Jenkins :
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://sheets.googleapis.com/v4/spreadsheets/****:batchUpdate?alt=json returned "Invalid requests[0].addSheet: A sheet with the name "PERF-DEPT" already exists. Please enter another name.". Details: "Invalid requests[0].addSheet: A sheet with the name "PERF-DEPT" already exists. Please enter another name.">

PERF-DEPT is the first sheet in the Cloud Tags workbook with id 0, which is causing script to try to create a new worksheet (because of how Python treats the integer 0).

FIX: Modified the code to handle return value differently, so sheet id 0 does not lead to creating a new sheet (if block).

For security reasons, all pull requests need to be approved first before running any automated CI

@pragya811 pragya811 self-assigned this Nov 24, 2025
@pragya811 pragya811 requested review from ebattat and inntran November 24, 2025 10:23
@pragya811 pragya811 added the ok-to-test PR ok to test label Nov 24, 2025
if sheet['properties']['title'] == sheet_name:
return sheet['properties']['sheetId']
return ''
return None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we retrun None instread of string, is it ok when using this method ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted the 'return None' change as it may disturb other api's. Instead added another check in create_work_sheet() to check for '', so sheet id 0 is not evaluated to True

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the new changes locally

@ebattat ebattat requested a review from AlAtsal November 24, 2025 16:17

@ebattat ebattat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@ebattat ebattat merged commit d90588d into redhat-performance:main Nov 25, 2025
18 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Cloud-Governance project Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test PR ok to test

Projects

Development

Successfully merging this pull request may close these issues.

2 participants