Getting the export · Google Cloud
How to export one month of Google Cloud costs.
The BigQuery billing export for one invoice month, saved as CSV: the query, the clicks and a sample file. One month is enough. The file is read in your browser tab and never uploaded.
BigQuery billing export
~10 MIN · DATA FROM THE DAY YOU ENABLE ITRecommended: every server is mapped exactly
- Open Billing → Billing export and enable the Standard usage cost BigQuery export (the Detailed export works too). There is no backfill: if it is not on yet, turn it on and come back next month.
- In BigQuery, run the query below for the month you want (replace the table name; the detailed table is called gcp_billing_export_resource_v1_…).
- Save results → CSV. A full month is usually too big for the direct download, so save to Google Drive or a bucket and download from there.
Compute is billed per core-hour and GB-hour, so machine families are sized as pools at your target utilisation.
The query
SELECT service.description, sku.description, usage_start_time, cost, currency, currency_conversion_rate,
(SELECT IFNULL(SUM(c.amount), 0) FROM UNNEST(credits) c) AS credits_total,
usage.amount, usage.unit, usage.amount_in_pricing_units, usage.pricing_unit, cost_type, invoice.month
FROM `PROJECT.DATASET.gcp_billing_export_v1_XXXXXX_XXXXXX_XXXXXX`
WHERE invoice.month = '202609'The query sums the credits column, so committed-use and sustained-use discounts are subtracted from “today”; without it the cost column is before credits and reads high. Costs in another currency are converted with the export’s own rate.
What the file needs to contain
Download a sample to compareColumn names are matched case-insensitively; extra columns are ignored.
- service.description
- sku.description
- usage_start_time
- cost
- usage.amount_in_pricing_units
- usage.pricing_unit
- invoice.month
A Billing “cost table” CSV from the console has service totals only and is read like a Cost Explorer file. The FOCUS BigQuery view exported as CSV is read too.
Have the file? Open the calculator and drop it in, or start from the Google Cloud sample.