Google Sheets (Service Account) icon

Google Sheets (Service Account)

Access Google Sheets API using Service Account

Actions11

Sheet → Clear

AI-generated

Overview

This node operation clears data from a specified range within a sheet in a Google Sheets spreadsheet using a service account for authentication. It is useful for scenarios where you need to remove existing data from a sheet before updating or reusing it, such as resetting a report or clearing input fields in a form spreadsheet.

Use Case Examples

  1. Clearing the range A1:D10 in a sheet named 'Sheet1' to remove old data before appending new data.
  2. Clearing an entire column range (e.g., A:Z) in a sheet to reset the sheet's content.

Properties

Name Meaning
Authentication Choose the authentication method to access the Google Sheets API, either using saved credentials or manual entry.
Service Account Email The email address of the service account used for authentication (required if manual authentication is selected).
Private Key The private key associated with the service account (required if manual authentication is selected).
Impersonate Email (Optional) Email of a user to impersonate, requiring domain-wide delegation (optional, manual authentication only).
Spreadsheet ID The unique identifier of the Google Sheets spreadsheet containing the sheet to clear.
Sheet Name The name of the sheet within the spreadsheet where the data will be cleared.
Range The cell range within the sheet to clear, e.g., A1:D10 or A:Z.

Output

JSON

  • json
    • spreadsheetId - The ID of the spreadsheet where the clear operation was performed.
    • updatedRange - The range within the sheet that was cleared.

Dependencies

  • Google Sheets API via googleapis library
  • Service account credentials for Google Sheets API authentication

Troubleshooting

  • Ensure the service account has the necessary permissions to access and modify the specified spreadsheet.
  • Verify that the spreadsheet ID and sheet name are correct and exist in the target spreadsheet.
  • If using manual authentication, ensure the private key is correctly formatted and includes proper newline characters.
  • Check that the range specified is valid and within the bounds of the sheet.
  • Common error: 'Sheet not found' - occurs if the sheet name does not exist in the spreadsheet; verify the sheet name spelling and existence.
  • Common error: 'No credentials provided' - occurs if credentials are missing or not selected; ensure credentials are configured or manual authentication details are provided.

Links

Discussion