How the Vigilant + Google Sheets integration works
By TrackJud
Connect the Vigilant API to Google Sheets to automate lawsuit search by CPF directly in your spreadsheet. Architecture, Apps Script, decisions, and when it makes sense. Updated April 2026.
TL;DR: Google Sheets + Google Apps Script + Vigilant API = automated lawsuit search directly in the spreadsheet, without leaving Google Workspace. The lawyer adds a CPF in the sheet, clicks “Search” (or schedules it to run weekly), and the cases appear in the rows below. Zero infrastructure, zero tool cost (Apps Script is free), API cost = R$ 0.10 per query. Practical limit: ~50-100 CPFs per execution. For larger volumes, scale to Make/n8n.
Google Sheets is one of the most-used tools in Brazilian law firms and compliance teams. Lawyers, interns, and analysts build spreadsheets to track client portfolios, deadlines, court fees — and, almost always, manually pasted lawsuit search results. This is one of several ways to automate lawsuit research in a law firm.
The problem: this research is still a manual process. The lawyer opens each court website, types the CPF, copies the result into the spreadsheet. Since the spreadsheet already exists and is part of the firm’s workflow, the natural question is: why not call the Vigilant API from within the spreadsheet itself?
This article explains the concept, when it makes sense to use this approach, and what decisions you need to make before starting. To understand the endpoints, schemas, and response formats you will consume, the official API documentation has the complete technical reference in curl, Python, and JavaScript — you adapt it to whatever environment you use.
Note for international readers: CPF is Brazil’s individual taxpayer ID. Every Brazilian court case references parties by CPF, and Vigilant’s API takes it as the primary search parameter.
The core idea
Google Sheets has a built-in scripting engine called Google Apps Script, which is JavaScript running in Google’s cloud, free, with direct access to spreadsheet cells. Apps Script can make outbound HTTP calls, so it can call the Vigilant API just like any other client.
This makes it possible to create custom functions that the lawyer uses like any native Sheets formula:
=SEARCH_CPF(A2, "TJSP,TJMG")
You type this formula into a cell, Apps Script calls the Vigilant API, receives the JSON with lawsuits, and returns a summary. The lawyer sees the case count appear in real time, without leaving the spreadsheet.
High-level architecture
[ Google Sheets spreadsheet ]
│
│ (custom formula =SEARCH_CPF)
↓
[ Apps Script (JavaScript) ]
│
│ HTTPS
↓
[ Vigilant API ]
│
↓
[ Brazilian courts ]
Nothing more complex than that. The spreadsheet triggers the script, the script calls the API, the API returns JSON, the script extracts what matters and writes to the cell.
When this approach makes sense
This pattern is ideal when:
- Low to medium volume — up to ~500 searches per month. Above that, direct API use or a custom backend are more efficient.
- No technical team — does not require a developer. A lawyer with basic notions copies the official doc example and adapts.
- Spreadsheet-centric workflow — makes more sense to integrate into the tool the firm already uses than to force a process change.
- Ad-hoc or exploratory searches — lawyer pastes a list of prospect CPFs and quickly sees who has case history.
It does not make sense when:
- High volume (thousands of searches per month) — Apps Script has a 30-second execution limit for custom functions, and Google imposes daily external-fetch quotas.
- Workflow needs to be transactional — not production-grade SLA.
- Sensitive data — the API key lives in the Apps Script code and can leak if the spreadsheet is shared incorrectly.
Decisions you need to make upfront
1. Where to store the API key
The safest approach is to use PropertiesService in Apps Script, which stores the key outside the source code. Even if someone views the script, the key does not appear. The official API documentation explains the step-by-step.
2. Synchronous or asynchronous function
Vigilant returns cached results instantly (status 200) or starts a background job (status 202). For spreadsheets, the most comfortable approach is to use cache only: if the data is fresh, it returns immediately; if not, it returns “processing” and you re-run the formula later. This avoids timeouts inside Apps Script.
3. One cell = one CPF vs one cell = one court
You can structure the spreadsheet two ways:
- One row per CPF, with a summary cell per court:
=SEARCH_CPF(A2, "TJSP"),=SEARCH_CPF(A2, "TJMG"), etc. - One row per case found, using a function that returns multiple rows (Apps Script supports return arrays)
The first is simpler; the second is better for detailed analysis. Choose based on usage.
4. When to re-search
Apps Script does not re-execute formulas by itself unless you change a cell. If you want automatic updates (monitoring), use a time trigger that re-executes a function every Monday at 7 AM, for example. Then the spreadsheet becomes a small monitoring system — not an on-demand query.
Usage patterns in a law firm
New-client due diligence
A tab with a list of prospect CPFs. A column with the formula =SEARCH_CPF(cpf, courts). The lawyer pastes the CPFs, hits Enter, and in seconds sees who has case history — triage tool before accepting the case.
Active portfolio monitoring
List of active clients. Weekly trigger that re-searches all and compares with the previous total. If any client has new cases, sends an email to the responsible lawyer (Apps Script has native Gmail access).
Supplier triage
List of suppliers + partner CPFs. Monthly re-search. Alert if the case volume crosses a threshold.
Practical limits
- Timeout: Apps Script custom functions have a 30-second timeout. Searching 10+ courts can exceed this. Break into smaller calls.
- Daily quota: Google limits
UrlFetchAppcalls to 20,000/day on free accounts. More than enough for small and medium firms. - Sharing: if you share the spreadsheet with edit permission, Apps Script runs with the owner’s credentials. Could be a problem for whoever pays, not for the key itself.
- Returned data: Vigilant’s JSON is large (parties, movements, subjects). Extract only what matters in the formula — do not paste the entire JSON into a cell.
When to migrate to something more robust
When you feel:
- Slowness in searches (frequent timeouts)
- Need for precise scheduling (not just “Monday 7 AM”, but “every day at 3 AM”)
- Historical storage (compare cases between executions, generate reports)
- Integration with other tools (CRM, Slack, firm ERP)
The natural evolution is to move out of Apps Script and use a visual automation tool (Make, n8n, Zapier) or a custom backend. But for 80% of cases, the spreadsheet solves it.
Legal aspects
Public court data has legal basis for processing under LGPD (Brazil’s GDPR equivalent — Art. 7, §4). No problem processing public consultation results inside a corporate firm spreadsheet, as long as the purpose is legitimate (client defense, risk management, compliance).
The API key is a sensitive asset of your firm (not of the CPF holder). Protect the key like a password — use PropertiesService, do not leave it exposed in shared spreadsheets.
API technical reference
The concrete implementation depends on the endpoints, schemas, and responses the API exposes. The official documentation is where this lives maintained and up-to-date:
- vigilant.trackjud.com.br/api/docs — interactive Scalar UI (English and Portuguese)
There you find: the authentication flow (how to get an API key), the format of each endpoint, response schemas (ProcessRecord, Consult, CourtSources), error codes per RFC 7807, and request examples in curl, Python, and JavaScript. From those base examples, you adapt to whatever environment you prefer — an Apps Script function, a Make workflow, or a custom backend.
Conclusion
Integrating Vigilant with Google Sheets is a realistic shortcut for firms that already have their workflow centralized in a spreadsheet and want to eliminate the manual part of the research. The complexity is low, the return is immediate, and the scale ceiling (Apps Script) is enough for most small and medium firms.
If you fit that profile, start with the most painful use case (usually new-client triage or portfolio monitoring), build a small proof-of-concept spreadsheet, validate, and expand.
5 free credits on sign-up. No credit card. Create a Vigilant account.
Frequently asked questions
Minimally. Google Apps Script is simplified JavaScript — if you can copy-paste code and change variables (like the API key and court list), you can do the integration. Ready-to-copy code is in this article and the API docs. For those who don't want to touch any code, the alternative is using Make (Integromat) as a visual intermediary between Sheets and the API.
Yes, but with different technology. In Excel, the equivalent of Apps Script is Power Query (for REST queries) or VBA (for full automation). Power Query connects natively to REST APIs and can fetch JSON. VBA is more powerful but less accessible for non-programmers. If you use Excel Desktop, Power Query is recommended. If Excel Online, the integration is more limited — consider migrating to Google Sheets.
Google Apps Script has a 6-minute execution limit per trigger. In practice, this allows processing ~50-100 CPFs per execution (depending on court count and cache warmth). For larger volumes, split into batches (50 CPFs per execution, trigger every 15 minutes) or move to Tier 2 automation (Make/n8n) which doesn't have this limit. Details on the 3 automation tiers at [how to automate lawsuit search](/en/blog/automate-lawsuit-search-law-firm/).
Yes. Apps Script has time-based triggers. You configure it to run daily, weekly, or monthly — the spreadsheet calls the API on its own, records results, and can send a summary email. This is the foundation of spreadsheet-based continuous monitoring. More details at [lawsuit monitoring with CPF alerts](/en/blog/brazilian-lawsuit-monitoring-alerts/).
Google Apps Script is free (part of Google Workspace). The only cost is Vigilant API usage: R$ 0.10 per query per court. For a firm processing 50 CPFs/week across 5 courts: 250 queries/week × R$ 0.10 = R$ 25/week = ~R$ 100/month. The 2-day cache reduces real cost by 30-50%. Pricing at [/en/pricing/](/en/pricing/).
Partially. Apps Script stores code in your Google account — it's not public. But if you share the spreadsheet with others, they can see the code (and the key). Recommendations: (1) use Apps Script's PropertiesService to store the key as an environment variable instead of hardcoding; (2) if the sheet is shared widely, use an intermediary (Make/webhook) that hides the key.
Related articles
Jun 02, 2026
How to automate lawsuit search at a law firm
Practical guide to automating per-CPF lawsuit lookup in a Brazilian law firm. 3 real paths (API integration, no-code, spreadsheet), real cost comparisons, and what the Bar Association and LGPD say. Updated April 2026.
Jun 16, 2026
Brazilian lawsuit monitoring: how to get automated alerts for new cases against a CPF
Practical guide to automated lawsuit monitoring: how it works, 3 implementation tiers (spreadsheet, no-code, backend), real costs, best practices, and how to integrate alerts into your workflow. Updated April 2026.
Apr 28, 2026
Brazilian court data API: how to automate lawsuit research across 10 states
Integrate the Vigilant REST API to query Brazilian court cases. Endpoints, auth, cache behavior, RFC 7807 errors, and examples in cURL, Python, JavaScript. Updated April 2026.