Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Document, tabs parameter not respected #2559

Open
kbridbur opened this issue Jan 30, 2025 · 0 comments
Open

Create Document, tabs parameter not respected #2559

kbridbur opened this issue Jan 30, 2025 · 0 comments
Assignees

Comments

@kbridbur
Copy link

kbridbur commented Jan 30, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants