Google Drive (Service Account) icon

Google Drive (Service Account)

Access Google Drive API using Service Account

Overview

This node allows users to create a file in Google Drive using a service account for authentication. It supports both credential-based and manual authentication methods. Users can specify the file name, content (text or base64), parent folder ID, and additional optional fields such as description and MIME type. This node is useful for automating file creation in Google Drive, such as generating reports, saving logs, or uploading documents programmatically.

Use Case Examples

  1. Automatically create a text report file in a specific Google Drive folder after a workflow execution.
  2. Upload a base64 encoded image file to Google Drive with a custom MIME type and description.

Properties

Name Meaning
Authentication Choose the authentication method: use saved credentials or enter service account details manually.
Service Account Email The email address of the service account used for authentication (required if manual authentication is selected).
Private Key The private key from the service account JSON used for authentication (required if manual authentication is selected).
Impersonate Email (Optional) Email of the user to impersonate, requires domain-wide delegation (optional).
File Name The name of the file to be created in Google Drive.
File Content The content of the file, which can be plain text or base64 encoded data.
Parent Folder ID The ID of the parent folder where the file will be created. Leave empty to create in the root folder.
Additional Fields Optional additional fields for the file such as description and MIME type.

Output

JSON

  • id - The unique identifier of the created file in Google Drive.
  • name - The name of the created file.
  • mimeType - The MIME type of the created file.
  • description - Description of the file if provided.
  • parents - Array of parent folder IDs where the file is located.
  • createdTime - Timestamp when the file was created.
  • modifiedTime - Timestamp when the file was last modified.
  • size - Size of the file in bytes.

Dependencies

  • Google Drive API
  • Google service account credentials (email and private key)

Troubleshooting

  • Ensure that the service account has the necessary permissions to create files in the target Google Drive or folder.
  • If using manual authentication, verify that the private key is correctly formatted and includes proper newline characters.
  • Common error: 'No credentials provided' - occurs if credentials are missing or not selected; resolve by providing valid credentials or switching authentication method.
  • Errors related to insufficient permissions may occur if the service account or impersonated user lacks access rights to the specified folder or Drive.

Links

Discussion