Google Docs
Read all tabs in a Google Doc
Request the document with tab content enabled when an integration needs every tab. Use the Google Docs client method for the same document resource in code.
Documentation reviewed · 2 methods with sources
Ways to do it
- API: GET /v1/documents/{documentId}?includeTabsContent=true
- SDK: docs.documents.get({ documentId, includeTabsContent: true })
API
GET /v1/documents/{documentId}?includeTabsContent=true
Fetch a document and populate its tabs tree instead of returning only the first tab’s body fields.
Read source: Google Docs documents.get reference- Requirements
- A Google Cloud project with the Docs API enabled, OAuth access to the document, and a document ID. Use a Docs or Drive read scope.
- Limitations
- When includeTabsContent is true, top-level body and documentStyle text fields are left empty. Traverse document.tabs and nested child tabs instead.
Example shell
curl --fail -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" "https://docs.googleapis.com/v1/documents/$DOCUMENT_ID?includeTabsContent=true"SDK
docs.documents.get({ documentId, includeTabsContent: true })
Use the generated Google API client to fetch a document with its tabs populated.
Read source: Pinned Google Docs Node.js client method- Requirements
- The googleapis Node.js client configured with OAuth credentials that can read the document and the document ID.
- Limitations
- With this flag enabled, read tab text under data.tabs and each tab’s childTabs. The top-level body is empty.
Example text
const { data } = await docs.documents.get({ documentId, includeTabsContent: true });