Status Update
Comments
jp...@google.com <jp...@google.com> #2
Generated Metadata
- Summary: The DocumentApp.create method in Google Apps Script fails when additional tabs or URL parameters are present in the Google Document URL. This prevents developers from reliably creating new documents in environments with complex URL structures.
- Tags:
,document-app ,document-create ,url-parameters ,apps-script-error google-docs-api
Additional resources:
bl...@google.com <bl...@google.com> #3
jp...@google.com <jp...@google.com> #4
However, when additional tabs are introduced in the URL (e.g., .../edit?tab=t.xxxxxxxx), it fails to work.
Can you elaborate on this? There is no usage of this with the code.
sh...@gmail.com <sh...@gmail.com> #5
In contrast, a URL ending in .../edit?tab=t.xxxxxxxx (where 'xxxxxxxx'
represents any characters) refers to other tabs in the same document.
2025년 1월 7일 (화) 오후 1:49, <buganizer-system@google.com>님이 작성:
jp...@google.com <jp...@google.com> #6
But how does that relate to the code shared?
sh...@gmail.com <sh...@gmail.com> #7
specific situation.
When the first tab is active and indicated as tab=t.0 in the URL, the
feature (DocumentApp.create) works correctly.
However, when another tab (e.g., tab=t.xxxxxxxx) is active and not
displayed as tab=t.0, executing DocumentApp.create results in the following
error:
Exception: Unexpected error while getting the method or property create on
object DocumentApp.
2025년 1월 7일 (화) 오후 3:52, <buganizer-system@google.com>님이 작성:
jp...@google.com <jp...@google.com> #8
Please list the specific steps to recreate.
hy...@flowstate.kr <hy...@flowstate.kr> #9
sh...@gmail.com <sh...@gmail.com> #10
-
Create a new Google Document.
-
Open the Apps Script editor.
-
Add the following code to the Code.gs file:
function testCreateDocument() {
try {
var newDoc = DocumentApp.create('document new');
Logger.log('Success: ' + newDoc.getUrl());
} catch (e) {
Logger.log('Failure: ' + e);
}
}
3-1. Select the function testCreateDocument.
3-2. Run the function testCreateDocument. // works.
-
Return to the Google Document created in Step 1.
-
create a new tab.
-
Select the new tab (the URL will include tab=t.xxxxxxxx).
-
Go back to the Apps Script editor (=Step 2).
7-1. Select the function testCreateDocument.
7-2. Run the function testCreateDocument. // This will result in an error. (Exception: Unexpected error while getting the method or property create on object DocumentApp.)
jp...@google.com <jp...@google.com> #11
I have reported this to the engineering team and future updates will be shared here. Thank you for your patience.
sh...@gmail.com <sh...@gmail.com> #12
2025년 1월 9일 (목) 오후 5:10, <buganizer-system@google.com>님이 작성:
Description
This(DocumentApp.create) Google Apps Script (GAS) binding with Google Document works well under normal circumstances. (URL: .../edit?tab=t.0)
However, when additional tabs are introduced in the URL (e.g., .../edit?tab=t.xxxxxxxx), it fails to work.
Error
Exception: Unexpected error while getting the method or property create on object DocumentApp.
Impact
This issue significantly impacts the reliability of Google Apps Script when working with Google Docs in scenarios where tabs or additional URL parameters are involved. It may block developers from implementing scripts in environments with complex URL structures or when Google services append query parameters dynamically. The inability to create new documents under these conditions limits script usability and integration with workflows relying on URL-based navigation.