From 2a6dbacdde7051ef453d0590ebd5fe834a86236c Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Wed, 16 Oct 2024 09:54:43 -0600 Subject: [PATCH] fix: advanced docs params after id --- advanced/docs.gs | 2 +- docs/quickstart/quickstart.gs | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/advanced/docs.gs b/advanced/docs.gs index e760e2dd9..ee4e7e191 100644 --- a/advanced/docs.gs +++ b/advanced/docs.gs @@ -144,7 +144,7 @@ function insertAndStyleText(documentId, text) { function readFirstParagraph(documentId) { try { // Get the document using document ID - const document = Docs.Documents.get({'includeTabsContent': true}, documentId); + const document = Docs.Documents.get(documentId, {'includeTabsContent': true}); const firstTab = document.tabs[0]; const bodyElements = firstTab.documentTab.body.content; for (let i = 0; i < bodyElements.length; i++) { diff --git a/docs/quickstart/quickstart.gs b/docs/quickstart/quickstart.gs index 605cfe759..5ef105882 100644 --- a/docs/quickstart/quickstart.gs +++ b/docs/quickstart/quickstart.gs @@ -21,14 +21,7 @@ */ function printDocTitle() { const documentId = '195j9eDD3ccgjQRttHhJPymLJUCOUjs-jmwTrekvdjFE'; - try { - // Get the document using document id - const doc = Docs.Documents.get({'includeTabsContent': true}, documentId); - // Log the title of document. - console.log('The title of the doc is: %s', doc.title); - } catch (err) { - // TODO (developer) - Handle exception from Docs API - console.log('Failed to found document with an error %s', err.message); - } + const doc = Docs.Documents.get(documentId, {'includeTabsContent': true}); + console.log(`The title of the doc is: ${doc.title}`); } // [END docs_quickstart]