HTML to Google Docs icon

HTML to Google Docs

Upload HTML content to Google Docs

Overview

This node uploads HTML content to Google Docs by creating a new Google Document with the specified name and HTML content. It is useful when you want to programmatically generate or update Google Docs from HTML sources, such as converting web content, email templates, or reports into editable Google Documents.

Practical examples include:

  • Automatically generating formatted reports or invoices in Google Docs from HTML templates.
  • Migrating or backing up HTML-based content into Google Docs for collaboration.
  • Creating Google Docs from dynamic HTML content generated by other nodes or workflows.

Properties

Name Meaning
Document Name The name/title of the Google Doc to create.
HTML Content The HTML content to upload into the Google Doc. Supports multiline input (e.g., <h1>My Document</h1>).

Output

The node outputs an array of JSON objects, each representing the created Google Document. Each output item contains the full response from the Google Drive API after uploading the document, including metadata such as the document ID, name, MIME type, and other Google Drive file properties.

Example output structure (simplified):

{
  "id": "string",
  "name": "string",
  "mimeType": "application/vnd.google-apps.document",
  ...
}

No binary data is produced by this node.

Dependencies

  • Requires valid Google Drive API credentials with OAuth2 authentication configured in n8n.
  • The node uses the Google Drive API endpoint https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart to upload the document.
  • Proper OAuth2 scopes must be granted to allow file creation on Google Drive.

Troubleshooting

  • Failed to retrieve Google Drive credentials: This error occurs if the node cannot access the required Google Drive OAuth2 credentials. Ensure that the credentials are properly set up and authorized in n8n.
  • HTTP request errors: If the Google API returns errors (e.g., permission denied, quota exceeded), check your Google Cloud project settings, API quotas, and OAuth2 token validity.
  • Empty HTML content: If no HTML content is provided either via the node parameter or input JSON (html field), the created document may be empty or invalid. Make sure to provide valid HTML content.
  • Continue On Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output JSON.

Links and References

Discussion