Google Sheets Trigger (Service Account) icon

Google Sheets Trigger (Service Account)

Handle Google Sheets changes via webhooks (using Drive API)

Google Sheets Trigger (Service Account)

AI-generated

Overview

This node triggers workflows based on changes in a specified Google Sheets spreadsheet using a service account. It listens for events such as spreadsheet updates or sharing changes via Google Drive API webhooks. This is useful for automating processes that depend on real-time updates to Google Sheets, such as data synchronization, notifications, or logging changes.

Use Case Examples

  1. Trigger a workflow when a Google Sheets spreadsheet is updated to automatically process new data entries.
  2. Start a workflow when a spreadsheet is shared to notify team members or update permissions elsewhere.

Properties

Name Meaning
Spreadsheet ID The ID of the Google Sheets spreadsheet to watch for changes.
Events The types of events to listen for on the spreadsheet, such as updates or sharing changes.

Output

JSON

  • event - The type of event that triggered the webhook (e.g., update, share).
  • resourceId - The ID of the resource (spreadsheet) that triggered the event.
  • changed - An array of specific changes that occurred, if provided.
  • channelId - The ID of the webhook channel used for this event.
  • timestamp - The ISO timestamp when the event was received.

Dependencies

  • Google Sheets API access via a service account with Drive and Sheets scopes.

Troubleshooting

  • Ensure the service account credentials are correctly configured and have the necessary permissions for Drive and Sheets APIs.
  • If webhook creation fails, check that the spreadsheet ID is correct and the Google API quotas are not exceeded.
  • If no events trigger, verify that the selected event types match the actual changes occurring in the spreadsheet.
  • Common error: 'No credentials provided' - ensure the Google Sheets service account credentials are set up in n8n.
  • Common error: 'Failed to create webhook' - check network connectivity and API permissions.

Links

  • Google Drive API Push Notifications - Documentation on setting up push notifications (webhooks) for Google Drive files, including spreadsheets.
  • Google Sheets API - Official Google Sheets API documentation for understanding spreadsheet operations and permissions.

Discussion