🎣 Enrich Google Sheets with Dun & Bradstreet data blocks

⚑ 211 views · 🎣 Lead Generation & Enrichment

Description

Automate company enrichment directly in Google Sheets using Dun & Bradstreet (D&B) Data Blocks. This workflow reads DUNS numbers from a sheet, fetches a Bearer token (via Basic Auth β†’ /v3/token), calls the Data Blocks API for each row (/v1/data/duns/...), extracts Paydex, and appends or updates the sheet. A Filter node skips rows already marked Complete for efficient, idempotent runs.


βœ… What this template does


πŸ‘€ Who’s it for


🧩 How it works (node-by-node)

  1. Get Companies (Google Sheets) – Reads rows with at least duns, paydex, Complete.
  2. Only New Rows (Filter) – Passes only rows where Complete is empty.
  3. D&B Info (HTTP Request) – Calls Data Blocks for each DUNS using a header credential (Authorization: Bearer <token>).
  4. Keep Score (Set) – Maps nested JSON to a single Paydex field:
    {{$json.organization.businessTrading[0].summary[0].paydexScoreHistory[0].paydexScore}}
  5. Append to g-sheets (Google Sheets) – Append or Update by duns, writing paydex and setting Complete = Yes.

> The workflow also includes Sticky Notes with in-canvas setup help.


πŸ› οΈ Setup instructions (from the JSON)

1) Connect Google Sheets (OAuth2)

  1. In n8n β†’ Credentials β†’ New β†’ Google Sheets (OAuth2) and sign in.
  2. Use/prepare a sheet with columns like: duns, paydex, Complete.
  3. In your Google Sheets nodes, select your credential and target spreadsheet/tab.
  4. For upsert behavior, set Operation to Append or Update and Matching column to duns.

> Replace any example Sheet IDs/URLs with your own (avoid publishing private IDs).


2) Get a D&B Bearer Token (Basic Auth β†’ /v3/token) β€” Optional Dynamic Token Node

  1. Add/enable HTTP Request node named Get Bearer Token1.
  2. Configure:
    • Authentication: Basic Auth (your D&B username/password)
    • Method: POST
    • URL: https://plus.dnb.com/v3/token
    • Body Parameters: grant_type = client_credentials
    • Headers: Accept = application/json
  3. Execute to receive access_token.
  4. Reference the token in other nodes via:
    Authorization: Bearer {{$node["Get Bearer Token1"].json["access_token"]}}

> ⚠️ Security: Don’t hardcode tokens. Prefer credentials or fetch dynamically.


3) Call D&B Data Blocks (use Header Auth or dynamic token)

Node: D&B Info (HTTP Request)

> {{ $json.duns }} is resolved from the current row provided by Get Companies.


4) Map Paydex and Upsert to Google Sheets


πŸ§ͺ Test checklist


πŸ” Security & best practices


🩹 Troubleshooting


🧯 Customize further


πŸ“¬ Contact

Need help customizing this (e.g., enriching more fields, normalizing responses, or bulk-processing large sheets)?

πŸ”— Nodes Used

Google Sheets, HTTP Request, Filter

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup