Skip to content

Create Document, tabs parameter not respected #2559

Open
@kbridbur

Description

@kbridbur

Environment details

  • OS type and version: Mac, Apple M3 Max
  • Python version: 3.12.8
  • pip version: 24.3.1
  • google-api-python-client version: 2.160.0

Steps to reproduce

  1. Structure a create document request with any number of tabs in the tabs field
  2. Send request
  3. The request is valid and a document is created, but the document does not have any tabs other than the default "Tab 1"

Code example

from google.oauth2 import service_account
from googleapiclient.discovery import build
import json

SCOPES = ['https://www.googleapis.com/auth/documents']
SERVICE_ACCOUNT_FILE = './credentials.json'

credentials = service_account.Credentials.from_service_account_file(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES
)

docs_service = build('docs', 'v1', credentials=credentials)
request = {
    "title": "test",
    "tabs": [
        {
            "tabProperties": {
                "title": "test tab",
                "index": 0
            },
            "documentTab": {
                "body": {}
            }
        },
        {
            "tabProperties": {
                "title": "test tab2",
                "index": 1
            },
            "documentTab": {
                "body": {}
            }
        }
    ]
}

response = self.docs_service.documents().create(
            body=request).execute()
print(response["documentId"])
print(json.dumps(response["tabs"], indent=4))

See that only the default tab exists. If any names of parameters are changed/etc you will receive a 400 error which indicates that the client is indeed parsing the tabs parameter provided, but nothing appears to be done with it

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoThis issue needs more information from the customer to proceed.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions