Skip to main content

Create Document

Creates a new Google Docs document.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Title - The title for the new Google Docs document.

Output

  • Document Id - The ID of the newly created Google Docs document.

Options

  • Credentials - Google Docs credentials used to authenticate with the service.
  • Share With - An array of objects specifying users to share the document with. Each object must contain:
    • Role - The role to assign (e.g., "writer", "reader")
    • Type - The type of user (e.g., "user", "group")
    • EmailAddress - The email address of the user or group
  • Send Notification Mail - Whether to send notification emails to users the document is shared with. Default is false.

How It Works

The Create Document node integrates with Google Docs to create a new document. When executed, the node:

  1. Validates the provided inputs (Title)
  2. Authenticates with Google Docs using the provided credentials
  3. Creates a new Google Docs document with the specified title
  4. Optionally shares the document with specified users
  5. Optionally sends notification emails to shared users
  6. Returns the document ID of the newly created document

Requirements

  • Valid Google Docs credentials
  • A title for the new document
  • Valid email addresses for users to share with (if specified)

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Title
  • Empty or invalid Google Docs credentials
  • Invalid share with parameters (missing Role, Type, or EmailAddress)
  • Google Docs service errors

Usage Notes

  • The Title input is required and will be used as the document's title
  • The Document Id output can be used in subsequent nodes to modify the document
  • The Share With option allows you to specify multiple users or groups to share the document with
  • When sharing with users, make sure to specify the correct Role (writer, reader, etc.) and Type (user, group, etc.)
  • If Send Notification Mail is enabled, users will receive email notifications about the shared document
  • The created document will be owned by the account associated with the provided credentials

Practical Examples

Example 1: Create a Simple Document

Create a basic document with a title:

Inputs:

  • Title: "Monthly Sales Report - December 2024"

Result: A new Google Doc is created and the document ID is stored in $.document_id

Example 2: Create and Share with Team

Create a document and share it with team members:

Inputs:

  • Title: "Team Meeting Notes"

Options:

  • Share With:
[
{
"Role": "writer",
"Type": "user",
"EmailAddress": "john@company.com"
},
{
"Role": "reader",
"Type": "user",
"EmailAddress": "manager@company.com"
}
]
  • Send Notification Mail: true

Result: Document is created and shared with John (can edit) and manager (can view), both receive email notifications

Example 3: Automated Report Generation

Create daily reports with dynamic titles:

Inputs:

  • Title: "Daily Report - " + $.date (using JavaScript scope)

Use Case: Generate a new report document each day with a date-stamped title

Example 4: Share with Service Account for Automation

When using a service account, share with additional users:

Options:

  • Share With:
[
{
"Role": "writer",
"Type": "user",
"EmailAddress": "team@company.com"
}
]

Note: Service account creates the document. Sharing gives team members access.

Tips for Effective Use

  1. Use descriptive titles - Include dates, project names, or identifiers for easy searching
  2. Plan sharing upfront - Define who needs access during creation to avoid manual sharing later
  3. Silent sharing for automation - Set Send Notification Mail to false for automated processes
  4. Store Document IDs - Save the document ID output to a variable or data table for later use
  5. Combine with Insert nodes - Chain with Insert Text, Add Heading, etc. to build complete documents
  6. Use templates - Create base documents programmatically, then modify them
  7. Organize with naming - Use consistent naming patterns like "YYYY-MM-DD - Report Name"

Common Errors and Solutions

Error: "No Credential Content"

Cause: Credentials are not properly configured or missing

Solution:

  • Verify credentials are selected in the Options
  • Check that OAuth2 or Service Account credentials are properly set up
  • Re-authenticate if using OAuth2

Error: "ErrAuth" - Authentication failed

Cause: OAuth2 token expired or invalid credentials

Solution:

  • For OAuth2: Re-authorize by running the flow (browser prompt will appear)
  • For Service Account: Verify JSON key file is correct and account is active
  • Check Google Docs API is enabled in Google Cloud Console

Error: Permission denied when sharing

Cause: Email address doesn't exist or domain restrictions prevent sharing

Solution:

  • Verify email addresses are correct
  • Check Google Workspace domain sharing settings
  • Ensure the account has permission to share documents
  • For service accounts, verify the account exists and is active

Error: Invalid share parameters

Cause: Missing or incorrect Role, Type, or EmailAddress in Share With array

Solution:

  • Ensure each object has all three fields: Role, Type, EmailAddress
  • Valid Roles: "writer", "reader", "commenter"
  • Valid Types: "user", "group", "domain", "anyone"
  • Use correct email format

Integration Patterns

Pattern 1: Document Factory

Create multiple documents from a data table:

1. For Each Row in Data Table

2. Create Document (Title from row data)

3. Insert Text / Add Content

4. Store Document ID in results table

Pattern 2: Template + Personalization

Create personalized documents for each recipient:

1. Create Document (Title: "Invoice - " + customer name)

2. Share With customer email (Role: "reader")

3. Add Content with customer data

4. PDF Export and send via email

Pattern 3: Collaborative Workspace Setup

Set up shared documents for projects:

1. Create Document (Title: project name)

2. Share With multiple team members (different roles)

3. Send Notification Mail: true

4. Store Document ID in project database