Portal Community
Deletes the entire spreadsheet from Google Drive. Irreversible.

All sheet tabs, all rows, all formulas, all formatting, and all data in the file are permanently destroyed. This cannot be undone via the Sheets API or the Drive API. The spreadsheet is moved to the Google Drive Trash, where it remains recoverable by the file owner for 30 days — after which it is permanently purged. Do not use this operation without one or more of the following safeguards: an environment guard variable, a Human-in-the-Loop approval step, a prior data export, or an explicit ALLOW_SPREADSHEET_DELETE=true configuration flag.

When to Use

Configuration

FieldRequiredDescription
CredentialIdRequiredInteger ID referencing a stored Google credential in the BizFirst Credentials Manager. The authenticated user or service account must be the owner or have Delete access to the spreadsheet in Google Drive.
SpreadsheetIdRequiredThe ID of the spreadsheet to delete. Taken from the spreadsheet URL: https://docs.google.com/spreadsheets/d/{SpreadsheetId}/edit. This is the only required field — the operation deletes the entire file without further prompts.
Ownership requirement: The Google credential used must have Owner or Organizer access to the spreadsheet in Google Drive. Editor access is insufficient for deletion. If a service account created the spreadsheet, that same service account's credential must be used to delete it. Attempting to delete with a non-owner credential returns 403 Forbidden.

Validation Errors

Error CodeCause
VAL_MISSING_SPREADSHEET_IDSpreadsheetId is empty or whitespace.
VAL_INVALID_CREDENTIALCredentialId does not resolve to a valid Google credential.
PERMISSION_DENIEDThe authenticated user does not have Owner permission on the spreadsheet. Only the file owner can delete it.
FILE_NOT_FOUNDNo spreadsheet with the specified SpreadsheetId exists, or the file has already been deleted. Check for typos in the ID.
DRIVE_QUOTA_EXCEEDEDThe Google Drive operation could not complete due to a service-level error. Retry after a brief delay.

Output Fields

FieldTypeDescription
spreadsheetIdstringEchoed spreadsheet ID — record this in your audit log.
deletedbooleantrue when the spreadsheet was successfully moved to Trash.
statusstring"success".
resourcestringAlways "spreadsheet".
operationstringAlways "delete".

Sample Configuration

{
  "resource": "spreadsheet",
  "operation": "delete",
  "CredentialId": 12,
  "SpreadsheetId": "{{ $json.stagingSpreadsheetId }}"
}

In production scenarios, SpreadsheetId should always come from a Variable node or database record — never a hardcoded string — to prevent accidental deletion of the wrong file.

Sample Output

{
  "spreadsheetId": "1Xt4QzpNnFMdKvBdBZjgmRk9VE2upms7qptlbs74OgVE",
  "deleted": true,
  "status": "success",
  "resource": "spreadsheet",
  "operation": "delete"
}

Expression Reference

Assuming this node is named deleteStaging in the workflow:

ExpressionReturnsDescription
{{ $output.deleteStaging.deleted }}booleantrue when deletion completed successfully.
{{ $output.deleteStaging.spreadsheetId }}stringID of the deleted spreadsheet — write to audit log.
{{ $output.deleteStaging.status }}string"success" on success port.

Node Policies & GuardRails

Safe Delete Pattern

The following node sequence represents the recommended safe pattern for any production spreadsheet deletion workflow:

// Step 1 — Fetch and log spreadsheet metadata before deletion
// HttpRequest: GET https://www.googleapis.com/drive/v3/files/{{ $json.spreadsheetId }}?fields=name,createdTime,modifiedTime

// Step 2 — Export all data to archive
// For each sheet tab: sheet/get → sheet/append to archive spreadsheet

// Step 3 — Write audit log entry to database
// Database node: INSERT INTO deletion_audit (spreadsheet_id, title, deleted_by, deleted_at, archive_spreadsheet_id) VALUES (...)

// Step 4 — Approval gate (if required by policy)
// HIL node: "Approve deletion of {{ $json.title }}?" → wait for manager approval

// Step 5 — Environment check
// IF: {{ $env.ALLOW_SPREADSHEET_DELETE == "true" }}

// Step 6 — spreadsheet/delete
{
  "resource": "spreadsheet",
  "operation": "delete",
  "CredentialId": 12,
  "SpreadsheetId": "{{ $json.spreadsheetId }}"
}

// Step 7 — Log deletion result
// Database node: UPDATE deletion_audit SET confirmed_deleted=true WHERE spreadsheet_id=...

// Step 8 — Notify stakeholders
// Email / Slack: "Spreadsheet {{ $json.title }} has been deleted. Archive: {{ $output.archiveStep.spreadsheetUrl }}"

Workflow Examples

Example 1 — Pipeline Staging Cleanup

// At the end of a data transformation pipeline
// Only runs after all final writes have confirmed success on the success port
{
  "resource": "spreadsheet", "operation": "delete",
  "CredentialId": 15,
  "SpreadsheetId": "{{ $output.createStaging.spreadsheetId }}"
}
// createStaging is the spreadsheet/create node that ran at pipeline start
// spreadsheetId flows through the entire pipeline via output references

Example 2 — GDPR Client Data Erasure

// Trigger: Client erasure request received and approved via HIL
// After export to company archive is confirmed:
{
  "resource": "spreadsheet", "operation": "delete",
  "CredentialId": 12,
  "SpreadsheetId": "{{ $json.clientSpreadsheetId }}"
}
// Previous nodes: fetch metadata, export all data, write audit log, HIL approval
// Next nodes: update CRM record (spreadsheetId = null), send erasure confirmation email