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]