Partnerships CRM

Partnerships CRM: Google Sheets Sync

Google Sheets sync keeps CRM data and spreadsheet workflows aligned.


Sync Modes

ModeDirectionUse when
pushCRM -> SheetCRM is source of truth
pullSheet -> CRMteam bulk-edited sheet and wants those edits in CRM
mergepull then pushboth sides changed and you want normalized reconciliation

Required Env Variables

VariableRequiredNotes
PARTNERSHIPS_GSHEETS_ENABLEDrecommendedset false to hard-disable
PARTNERSHIPS_GSHEETS_AUTO_SYNCoptionalif true, successful writes trigger best-effort push
PARTNERSHIPS_GSHEETS_SPREADSHEET_IDyestarget spreadsheet id
PARTNERSHIPS_GSHEETS_SHEET_NAMEoptionaldefaults to PartnershipsCRM
PARTNERSHIPS_GSHEETS_SERVICE_ACCOUNT_JSONpreferredfull JSON credentials
PARTNERSHIPS_GSHEETS_SERVICE_ACCOUNT_EMAILfallbackused with private key
PARTNERSHIPS_GSHEETS_PRIVATE_KEYfallbackused with account email

Credentials stay backend-only

Do not expose service account credentials in frontend env vars.


One-Time Google Setup

Step 1: Create service account

  1. Open Google Cloud Console.
  2. Create/select project.
  3. Enable Google Sheets API.
  4. Create service account.
  5. Generate key JSON.

Step 2: Share spreadsheet

  1. Open target spreadsheet.
  2. Click Share.
  3. Add service account email as Editor.
  4. Save.

Step 3: Configure backend env and redeploy

Set env vars in the runtime where Partnerships backend runs, then deploy/restart service.


Local Testing Against A Real Sheet

  1. Export env vars in shell running serverless offline.
  2. Start partnerships service locally.
  3. Open CRM and check Sheets status card.
  4. Trigger manual sync (push) from Overview tab.
  5. Confirm spreadsheet updates.
  6. Edit one row in sheet.
  7. Trigger pull and verify CRM data updates.

Status Card Meanings

  • Not configured: missing/invalid env setup, or hard-disabled
  • Configured: credentials + sheet access validated
  • Configured but not accessible: credentials exist, but sheet cannot be opened

Status payload also returns:

  • diagnostics for env presence checks
  • lastSyncAt, lastSyncMode, lastSyncStatus
  • lastSyncSummary + lastSyncError

Auto-Sync Behavior

When PARTNERSHIPS_GSHEETS_AUTO_SYNC=true:

  • partner/event/link/document/comm mutations can trigger a best-effort push
  • write operation still succeeds even if auto-sync push fails
  • sync failure is logged and shown in sync status metadata

Pull Guardrails

During pull:

  • row with empty company/contact context is skipped
  • company is required
  • date fields must be YYYY-MM-DD
  • amount fields must parse as non-negative numbers
  • status/tier values are normalized to CRM formats

Warnings are returned in sync result summary for skipped/partial rows.


Formatting Applied To Sheet

After push, backend applies presentation rules:

  • frozen header row
  • grouped header color bands
  • status chips with color formatting
  • boolean highlights (alumni/archive)
  • adjusted column widths

Formatting logic is in services/partnerships/googleSheets.js.


Common Errors

Google Sheets sync is not configured.

  • missing spreadsheet id and/or credentials

...configured but the sheet could not be accessed.

  • wrong spreadsheet id
  • sheet not shared with service account
  • invalid private key (newline formatting issue)

Dynamo ResourceNotFoundException when checking status

  • local tables were not migrated (including meta table)

Previous
Gmail Sync Setup