Skip to main content

Enriching Brazilian company data with CNPJ API and Google Sheets

Workflow preview

Workflow preview
100%
Enriching Brazilian company data with CNPJ API and Google Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow automatically enriches Brazilian company data by fetching comprehensive CNPJ information from the MinhaReceita.org API and updating your Google Sheets spreadsheet. Perfect for data an...

Best for

  • Lead Generation automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.set, n8n-nodes-base.splitinbatches, n8n-nodes-base.httprequest, n8n-nodes-base.googlesheets, n8n-nodes-base.telegram, n8n-nodes-base.limit, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Vitorio Magalhães.

Original n8n.io source

1.1 Workflow description

Title
Enriching Brazilian company data with CNPJ API and Google Sheets
Workflow name
Enriching Brazilian company data with CNPJ API and Google Sheets

Overview

This workflow automatically enriches Brazilian company data by fetching comprehensive CNPJ information from the MinhaReceita.org API and updating your Google Sheets spreadsheet. Perfect for data analysts, sales teams, and anyone working with Brazilian business databases who needs to enrich company information at scale.

What it does

  • Reads CNPJ numbers from your Google Sheets spreadsheet
  • Fetches complete company data from Brazil's Federal Revenue database via MinhaReceita.org API
  • Updates your spreadsheet with comprehensive business information including address, tax status, partners, and more
  • Sends Telegram notifications when the process is complete
  • Processes data in batches to handle large datasets efficiently

Key Features

Free API - No authentication required, completely free to use
Comprehensive Data - 47+ fields of official Brazilian company information
Batch Processing - Handles up to 100 CNPJs per batch automatically
Smart Filtering - Only processes CNPJs that don't already have data
Real-time Updates - Updates your spreadsheet as data is retrieved
Progress Notifications - Get notified via Telegram when complete

Setup Requirements

Google Sheets Structure

Your spreadsheet must contain at minimum:

  • cnpj column with Brazilian CNPJ numbers (numbers only, no formatting)
  • razao_social column (used to identify records without data)

Credentials Needed

  • Google Sheets OAuth2 credentials configured in n8n
  • Telegram Bot credentials for notifications (optional but recommended)

Available Data Fields

The workflow can populate your spreadsheet with any or all of these official fields from Brazil's Federal Revenue:

🏢 Company Information

  • cnpj, razao_social, nome_fantasia, capital_social
  • porte, codigo_porte, natureza_juridica, codigo_natureza_juridica

📍 Address & Location

  • uf, municipio, codigo_municipio, codigo_municipio_ibge
  • bairro, logradouro, descricao_tipo_de_logradouro
  • numero, complemento, cep
  • pais, codigo_pais, nome_cidade_no_exterior

📞 Contact Information

  • email, ddd_telefone_1, ddd_telefone_2, ddd_fax

💼 Business Classification

  • cnae_fiscal, cnae_fiscal_descricao, cnaes_secundarios
  • regime_tributario, qualificacao_do_responsavel

📋 Registration Status

  • situacao_cadastral, descricao_situacao_cadastral
  • motivo_situacao_cadastral, descricao_motivo_situacao_cadastral
  • situacao_especial, identificador_matriz_filial, descricao_identificador_matriz_filial
  • ente_federativo_responsavel

📅 Important Dates

  • data_inicio_atividade, data_situacao_cadastral, data_situacao_especial

🏛️ Tax Regime Information

  • opcao_pelo_mei, data_opcao_pelo_mei, data_exclusao_do_mei
  • opcao_pelo_simples, data_opcao_pelo_simples, data_exclusao_do_simples

👥 Partners & Shareholders

  • qsa (Complete structured data of company partners and shareholders)

How to Use

  1. Prepare your spreadsheet with CNPJ numbers in the cnpj column
  2. Configure your Telegram ID in the Settings node for notifications
  3. Set up Google Sheets credentials in n8n
  4. Add the desired data columns to your spreadsheet (any combination from the list above)
  5. Run the workflow - it will automatically process all CNPJs without existing data

Performance & Limitations

  • API Limits: None - completely free API from MinhaReceita.org
  • Data Accuracy: Official data from Brazil's Federal Revenue Service
  • Batch Size: Configurable (default: 100 records per batch)

Use Cases

  • Lead Enrichment: Enhance prospect databases with complete company information
  • Market Research: Gather comprehensive data about Brazilian companies
  • Compliance & Due Diligence: Verify company registration status and details
  • Sales Intelligence: Access contact information and company classification data
  • Data Cleaning: Standardize and complete existing company databases

Prerequisites

  • N8N instance with Google Sheets integration
  • Google Sheets document with CNPJ data
  • Basic understanding of Brazilian CNPJ format (14-digit company registration number)
  • Telegram bot token (optional, for notifications)

Important Notes

  • CNPJs must be active and registered with Brazil's Federal Revenue Service
  • The workflow only processes CNPJs where razao_social is empty (avoiding duplicates)
  • All data comes from official government sources via MinhaReceita.org
  • No rate limiting needed - the API is designed for bulk requests
  • Supports both matriz (headquarters) and filial (branch) identification

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Execute Workflow Manually

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - Settings

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Loop CNPJs

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 4 - Send API Request

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - Update CNPJ Info in Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 6 - Notify When Finish

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 7 - Limit Notifier Interactions

Type / Role
n8n-nodes-base.limit - limit
Config choices
Version 1

Block 8 - Get All CNPJs in Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 9 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Enriching Brazilian company data with CNPJ API and Google Sheets
Complexity advanced
Nodes 15
Categories Lead Generation, Multimodal AI
Author Vitorio Magalhães
Published 16 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7457/7457.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Enriching Brazilian company data with CNPJ API and Google Sheets do?

This workflow automatically enriches Brazilian company data by fetching comprehensive CNPJ information from the MinhaReceita.org API and updating your Google Sheets spreadsheet. Perfect for data an...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Lead Generation, Multimodal AI use case.