Guide · 7 min read
AI spend in Google Sheets, Looker or your data warehouse
By AI Spendbook · Published · Updated
Short answer
To get AI spend into Google Sheets or a BI tool, pull each provider's cost API on a schedule or use a tool that already reconciles them. Sheets suits a few providers and monthly totals; a warehouse table suits customer-level reporting in Looker or Tableau. Keep billed, estimated and allocated amounts in separate columns.
Key takeaways
- OpenAI and Anthropic both publish daily cost through admin APIs; Gemini cost arrives through the Cloud Billing export to BigQuery.
- A spreadsheet can import a CSV URL on refresh with IMPORTDATA in Google Sheets or From Web in Excel.
- For Looker or Tableau, load one row per day, provider and ledger kind, and never sum billed with estimated rows.
- Building your own dashboard is cheap to start; the cost is in reconciliation, late provider revisions and customer allocation.

Finance teams usually want AI spend where the rest of their reporting already lives: a Google Sheet for the monthly pack, Excel for the model, or a warehouse table behind Looker, Tableau or Power BI. The questions are where the numbers come from, how fresh they need to be, and which amounts may be added together. Where each provider reports cost is covered in tracking AI spend across OpenAI, Anthropic and Gemini.
How do you pull OpenAI and Anthropic usage into Google Sheets automatically?
- Do it yourself with Apps Script. A script calls the OpenAI Costs API and the Anthropic cost report with admin keys, writes rows to a sheet and runs on a time trigger. Store the keys in script properties, not in a cell, and remember that anyone who can edit the script can read them.
- Import a CSV URL. If a tool publishes the table as a CSV URL,
=IMPORTDATA("https://...")loads it into Google Sheets and Excel can read the same URL with Data, Get Data, From Web. Google Sheets decides how often it refreshes. - Download monthly. A CSV or Excel export after the close is enough when the sheet is only used for the board pack.
AI Spendbook's spreadsheet feeds take the second route: an analyst picks a table (customer margin, budgets, forecasts and others), and gets a URL shown once that returns the table as plain CSV. Anyone with the URL can read the table, so treat it like a password; a feed can expire and be revoked, and only a hash of its secret is stored. Details are in exports and feeds.
How do you export LLM usage with cost into Snowflake or BigQuery every day?
Write one row per UTC day, provider and ledger kind, and rewrite recent days on every run so a late bill or a provider correction replaces the earlier figure instead of adding a second copy. A useful shape:
| Column | Meaning |
|---|---|
| day | UTC day |
| provider | openai, anthropic, google, bedrock and so on |
| ledger_kind | billed, estimated or allocated; never add rows of different kinds |
| basis | billed, provider usage estimate or telemetry estimate |
| customer_id, feature, category | From request telemetry; empty on billed rows |
| accounting_class | Cost of revenue, R&D and so on, from your accounting rules |
| cost_micros, cost_usd | The amount |
AI Spendbook writes this table to BigQuery, Snowflake, Databricks or Amazon Redshift, or drops a CSV per day in Amazon S3 or Google Cloud Storage. It rewrites the last 7 complete days once a day. Each destination was built from the vendor's public API documentation and tested with recorded responses, not against a live account; setup and sample SQL are in warehouses. To total AI spend for a period, sum the allocated rows only; to compare the bill with the estimate, compare billed rows with estimated rows for the same day and provider. Why those two differ is explained in billed vs estimated AI spend.
If a FinOps tool already reads cloud billing in the FOCUS format, a FOCUS-style AI spend file can sit beside it: one row per day and provider, with BilledCost filled only on billed days and list and contracted cost priced from usage. AI Spendbook exports that file too.
How do you build an AI cost dashboard in Looker or Tableau?
Point the BI tool at the warehouse table rather than at each provider API. Define measures with a filter on the ledger kind, so a careless sum cannot add billed and estimated spend. A Looker view needs a day dimension group, the provider, customer and feature dimensions, and two measures: AI spend (allocated rows) and billed (billed rows). Tableau, Power BI and Metabase work the same way through their own warehouse connectors.
SELECT DATE_TRUNC(day, MONTH) AS month, customer_id, SUM(cost_micros) / 1e6 AS ai_spend_usd FROM finance.ai_spend_ledger WHERE ledger_kind = 'allocated' GROUP BY 1, 2
What are the common mistakes in a home-built AI spend report?
- Appending instead of replacing. Illustrative: a provider first reports $1,200 for November 3 and later revises it to $1,260. A job that appends both rows reports $2,460 for the day; a job that replaces the day reports $1,260.
- Mixing time zones. Provider cost APIs report UTC days. A sheet that buckets by local date moves late-evening spend into the next day and the month totals stop matching the invoice.
- Adding billed and estimated amounts. They are two views of the same usage. Report billed where it exists and the estimate only for days not billed yet.
- Rounding each row to cents. Thousands of small rows rounded one by one drift from the invoice. Store integer micros and round once in the report.
- Leaving the admin key in a cell. Anyone with view access can copy it. Keep it in script properties or a secret store.
Should you build your own AI cost dashboard or buy a tool?
| Part | Build it yourself | What usually goes wrong |
|---|---|---|
| Pull each provider's cost | A day per provider for the first version | Pagination, key rotation, providers changing report fields |
| Late bills and corrections | Rewrite recent days on every run | Appending instead of replacing double counts a revised day |
| Billed vs estimated | Keep both, label each day | Summing token estimates with the invoice |
| Cost per customer | Join request telemetry to the bill | Untagged requests silently dropped from the denominator |
| Month-end close | Freeze a copy each month | Last month's number changes after the board pack went out |
Building is reasonable when one provider covers most spend, you only need monthly totals, and an engineer owns the script. Buy, or at least borrow the data model, when several providers, customer margin or a monthly close are involved. Cost per customer explains the allocation step that most home-built dashboards skip.
Frequently asked questions
How often does a Google Sheets IMPORTDATA formula refresh?
Google sets the schedule. Its Sheets help on recalculation lists one hour for IMPORTDATA and the other import functions, and editing the formula forces a reload. For a fixed daily refresh, use an Apps Script time trigger instead.
Can Looker read AI spend straight from the OpenAI or Anthropic API?
Not directly. Looker queries a database, so the provider cost has to be loaded into a warehouse table first, by your own job or by a tool that writes the table for you.
Why should billed and estimated AI spend be separate columns in a BI tool?
Because they describe the same usage twice. Billed is what the provider charged; estimated is usage priced by you for days not billed yet. Adding them double counts, so keep them as separate measures and report one or the other.