ENGINEERING
Google Sheets: AI as a spreadsheet formula, on your own gateway
Just activated iSol API? Your key lives in the customer portal, isollm.ai/account → API keys. The endpoint used in every step below is https://tokens.4clouders.com/v1, and per-key spend updates on the same page. That is all you need to follow along.
Why this is the highest-leverage integration on this blog
Every other guide here serves a developer. This one serves finance, sales and operations, the people who live in a spreadsheet all day. After ten lines of script, AI becomes a formula they already know how to use: drag it down a column and 400 rows get classified.
Step 1: Open Apps Script
In the sheet: Extensions → Apps Script. Delete the placeholder function and paste this:
const ISOL_KEY = "sk-your-gateway-key"; // better: PropertiesService
const ISOL_URL = "https://tokens.4clouders.com/v1/chat/completions";
/**
* Asks the sovereign gateway and returns the answer in the cell.
* @customfunction
*/
function ISOL(prompt, system) {
const res = UrlFetchApp.fetch(ISOL_URL, {
method: "post",
contentType: "application/json",
headers: { Authorization: "Bearer " + ISOL_KEY },
payload: JSON.stringify({
model: "isol-4.9",
messages: [
{ role: "system", content: system || "Answer in one short line." },
{ role: "user", content: String(prompt) }
]
})
});
return JSON.parse(res.getContentText()).choices[0].message.content.trim();
}
Save. The @customfunction comment is what registers =ISOL() as a formula inside the sheet.
Step 2: Use it like any other formula
=ISOL("classifique: "&A2; "Classifique a despesa em UMA palavra: viagem, software, marketing, pessoal, infraestrutura, outros.")
Below, three real expense lines going through that exact prompt, answered by the gateway one row at a time:

Step 3: Make it survive a real sheet
- Constrain the vocabulary in the system prompt. "One word, from this list" is what turns an answer into a usable column.
- Sheets caches custom functions and recalculates on edit; for a one-off batch, paste the results as values afterwards so you do not pay for the same row twice.
- Store the key in
PropertiesServiceinstead of the source, so anyone with view access to the script cannot read it. - Long columns: Apps Script has execution quotas, so process in chunks of a few hundred rows.
Why the sovereign part matters here
A spreadsheet of expenses, salaries, customers or contracts is exactly the kind of file nobody wants pasted into a public chatbot. With this integration the data goes to an endpoint your company answers for, and the row never leaves that boundary.
=ISOL() rodando célula a célula com o vocabulário fixo no prompt. Três linhas de despesa, três categorias, uma palavra cada.Step 4: Verify at the gateway, not at the client
Whatever the tool's screen says, the source of truth is the key's ledger. Every request lands there with model and token counts, so if nothing shows up, the change did not take:
curl -s https://tokens.4clouders.com/key/info \
-H "Authorization: Bearer sk-your-gateway-key" | jq .info.spend
Try it on ours
Our gateway (iSol API) runs exactly this setup on sovereign infrastructure, US$ 99/month, 14-day trial.
Same gateway, rest of your stack: every guide with real sessions
The pattern: one gateway, every tool
WhatsApp
Telegram
GitHub Actions
Teams
Claude Code
Cursor
VS Code
aider
OpenCode
n8n
Zapier
Power Automate
Power BI
Website chatbot
Hermes Agent