Google Drive (Service Account) icon

Google Drive (Service Account)

Access Google Drive API using Service Account

Overview

This node allows updating files in Google Drive using a service account for authentication. It supports updating file metadata such as name, description, starred status, and trashed status. This is useful for automating file management tasks like renaming files, adding descriptions, or organizing files by starring or trashing them. For example, it can be used to update a report file's name and description after processing or to mark files as starred for quick access.

Use Case Examples

  1. Rename a file and update its description after generating a report.
  2. Mark a file as starred to highlight important documents.
  3. Move a file to trash programmatically based on certain conditions.

Properties

Name Meaning
Authentication Choose the authentication method, either using saved credentials or manual entry.
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, requires domain-wide delegation (optional, manual authentication only).
File ID The unique identifier of the file to update in Google Drive.
Update Fields Collection of fields to update on the file, including name, description, starred status, and trashed status.

Output

JSON

  • id - The unique identifier of the updated file.
  • name - The updated name of the file.
  • description - The updated description of the file.
  • starred - Indicates if the file is starred.
  • trashed - Indicates if the file is trashed.
  • mimeType - The MIME type of the file.
  • parents - Parent folder IDs of the file.
  • 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

Troubleshooting

  • Ensure the service account has the necessary permissions to update files in the target Google Drive.
  • If using manual authentication, verify the private key format is correct and newline characters are properly handled.
  • Common errors include authentication failures due to invalid credentials or insufficient permissions, and file not found errors if the provided file ID is incorrect.
  • To resolve permission errors, ensure the service account or impersonated user has access to the file and the Drive API is enabled in the Google Cloud project.

Links

Discussion