Insert Text
Inserts text into a 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.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Document Id - The ID of the Google Docs document to insert text into.
- Text - The text content to insert.
- Font Size - The font size for the inserted text.
- Font Name - The font family for the inserted text. Default is "Times New Roman".
Options
- Align - The alignment of the inserted text. Options are:
- Left (START)
- Center (CENTER)
- Right (END)
- Justify (JUSTIFIED)
- Bold - Whether to make the inserted text bold. Default is false.
- Italic - Whether to make the inserted text italic. Default is false.
- Underline - Whether to underline the inserted text. Default is false.
How It Works
The Insert Text node integrates with Google Docs to add text to a document. When executed, the node:
- Validates the provided inputs (Document Id, Text, Font Size, Font Name)
- Connects to the specified Google Docs document
- Inserts the specified text at the end of the document
- Applies the specified formatting options (font, size, alignment, styling)
Requirements
- A valid Google Docs document ID
- Valid Google Docs credentials
- Text content to insert
- Valid font size value
- Valid Google Docs permissions to modify the document
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Document Id
- Empty or invalid Text content
- Empty or invalid Font Size
- Google Docs service errors
- Insufficient permissions to modify the document
Usage Notes
- The Document Id can be found in the URL of the Google Docs document
- The text will be added at the end of the current document content
- The Font Name should be a valid Google Docs font family
- The Align option controls how the inserted text is positioned within the document
- Styling options (Bold, Italic, Underline) can be combined
Practical Examples
Example 1: Insert Simple Paragraph
Add a paragraph to the document:
Inputs:
- Document Id:
$.document_id - Text:
"This is a new paragraph added to the document." - Font Size:
"12" - Font Name:
"Arial"
Options:
- Align:
Left - Bold:
false
Result: Text is inserted at the end of the document with Arial 12pt font
Example 2: Insert Formatted Heading Text
Add bold, centered text for a section:
Inputs:
- Text:
"Important Notice" - Font Size:
"16" - Font Name:
"Roboto"
Options:
- Align:
Center - Bold:
true - Underline:
true
Use Case: Create emphasized section dividers
Example 3: Insert Dynamic Content
Insert data from variables:
Inputs:
- Text:
"Sales for " + $.month + ": $" + $.total_sales - Font Size:
"11" - Font Name:
"Times New Roman"
Example Output: "Sales for December: $45,230"
Example 4: Build Document Line by Line
Add multiple paragraphs in sequence:
Workflow:
1. Insert Text (Title with Font Size 18, Bold)
↓
2. Insert Text (Subtitle with Font Size 14, Italic)
↓
3. Insert Text (Body paragraph with Font Size 12)
↓
4. Insert Text (Conclusion with Font Size 12)
Example 5: Insert Data from Loop
Add rows from a data table:
Workflow:
For Each row in data_table:
Insert Text:
Text: $.row.name + " - " + $.row.value
Font Size: "11"
Font Name: "Arial"
Result: Each row becomes a line in the document
Tips for Effective Use
- Font compatibility - Use common fonts like Arial, Times New Roman, Roboto, or Calibri
- Font size range - Typical sizes are 10-14 for body text, 16-24 for headings
- Combine styles - Use Bold + Italic + Underline together when needed
- Text appending - Text always adds to the end; use multiple Insert Text nodes to build content
- Line breaks - Include
\nin text for line breaks within a paragraph - Test fonts first - Verify font names work in Google Docs before automating
- Use consistent formatting - Maintain same font/size for similar content types
Common Errors and Solutions
Error: "Document ID cannot be empty"
Cause: Document ID input is missing or undefined
Solution:
- Use Open Document or Create Document first to get document ID
- Verify
$.document_idvariable exists - Check previous nodes executed successfully
Error: "Text cannot be empty"
Cause: Text input is empty or variable doesn't contain value
Solution:
- Verify text variable has content
- Check for null or undefined values in dynamic text
- Add default text if source might be empty:
$.text || "Default text"
Error: "Font Size cannot be empty"
Cause: Font Size input is missing
Solution:
- Always provide a font size value (e.g., "12")
- Ensure variable contains a string number
- Use default like
"12"if dynamic value might be empty
Error: "Invalid font size"
Cause: Font size is not a valid number
Solution:
- Provide font size as string containing number:
"12"not12 - Avoid non-numeric values
- Typical range: 8-72 points
Error: "Failed to insert text"
Cause: Document permissions or API error
Solution:
- Ensure account has write access to document
- Check document isn't view-only
- Verify document wasn't deleted
- Retry the operation
Font not displaying correctly
Cause: Font name doesn't exist in Google Docs
Solution:
- Use standard Google Docs fonts: Arial, Calibri, Comic Sans MS, Courier New, Georgia, Helvetica, Roboto, Times New Roman, Trebuchet MS, Verdana
- Check exact spelling and capitalization
- Test font in Google Docs UI first
Integration Patterns
Pattern 1: Report Generation
Build formatted reports from data:
1. Create Document or Open Document
↓
2. Insert Text (Title - Bold, Size 18)
↓
3. Insert Text (Date/Time - Size 12)
↓
4. For Each data section:
Insert Text (Section header - Bold, Size 14)
Insert Text (Section content - Size 12)
↓
5. Insert Text (Footer/Signature - Italic, Size 10)
Pattern 2: Template Population
Fill document with personalized data:
1. Create Document (Title: "Report for " + customer)
↓
2. Insert Text (Greeting: "Dear " + customer_name)
↓
3. Insert Text (Body: personalized_content)
↓
4. Insert Text (Closing: signature_text)
Pattern 3: Data Table to Document
Convert structured data to document:
For Each row in table:
Insert Text:
Text: row.column1 + " | " + row.column2 + " | " + row.column3
Font: "Courier New" (monospace for alignment)
Size: "11"
Pattern 4: Multi-Language Content
Add content in different languages:
Insert Text (English content)
↓
Insert Text (Spanish content)
↓
Insert Text (French content)
Available Fonts
Common Google Docs fonts that work well:
- Arial - Clean, professional
- Times New Roman - Traditional, formal
- Roboto - Modern, readable
- Calibri - Contemporary, friendly
- Georgia - Elegant, serif
- Verdana - Web-friendly, clear
- Courier New - Monospace, technical
- Comic Sans MS - Casual (use sparingly)
Alignment Options
- Left (START) - Default, standard alignment
- Center (CENTER) - Centered text, good for titles
- Right (END) - Right-aligned, good for dates/signatures
- Justify (JUSTIFIED) - Even margins on both sides, formal documents