Google Drive (Service Account) icon

Google Drive (Service Account)

Access Google Drive API using Service Account

Overview

This node allows users to interact with Google Drive using a Service Account for authentication. Specifically, the 'Download' operation under the 'File' resource enables downloading the content of a specified file from Google Drive. This is useful for automating workflows that require retrieving file contents from Google Drive, such as backing up files, processing file data, or integrating with other systems that consume file content.

Use Case Examples

  1. Download a report file from Google Drive to process its content in an automation workflow.
  2. Retrieve a file's content to send it via email or upload it to another cloud service.

Properties

Name Meaning
Authentication Choose the authentication method: use saved n8n credentials or enter service account credentials manually.
Service Account Email The email address of the Google 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, requiring domain-wide delegation (optional, manual authentication only).
File ID The unique identifier of the file to download from Google Drive.

Output

JSON

  • fileId - The ID of the downloaded file.
  • content - The content of the downloaded file as text.

Dependencies

  • Google Drive API via googleapis library
  • Google Service Account credentials or saved n8n credentials for Google Drive

Troubleshooting

  • Ensure that the service account has the necessary permissions to access the specified file in Google Drive.
  • If using manual authentication, verify that the service account email and private key are correctly entered and formatted (private key must replace escaped newlines with actual newlines).
  • If impersonation is used, confirm that domain-wide delegation is properly configured for the service account.
  • Common error: 'No credentials provided' indicates missing or incorrect authentication setup; resolve by selecting valid credentials or entering manual credentials correctly.
  • Errors related to file ID usually mean the file does not exist or the service account lacks access rights.

Links

Discussion