# GCP usage export | Getting your cloud usage data guides
Source: https://greenpixie.com/docs/guides/cloud-usage-data/gcp

How to export detailed billing data to a Cloud Storage bucket.

First you enable the Cloud Billing **detailed usage cost** export to BigQuery. Then you set up a daily job that exports that table to a Cloud Storage bucket you own.

Enable the BigQuery export as early as possible, since it carries billing data only from the date it is enabled. For regional dataset locations such as `europe-west2`, Google does not backfill earlier usage, while US and EU multi-region locations receive some retroactive backfill that can take up to 5 days. History from before enablement cannot be recovered later.

## Before you start [#before-you-start]

You need:

* **Billing Account Administrator** on the billing account, and **BigQuery User** or higher on the host project.
* A project and BigQuery dataset to receive the export. Choose the dataset location per your data residency policy, noting the backfill behaviour above.
* A Cloud Storage bucket to receive the daily delivery. Create one, or use an existing bucket. If you plan to use Greenpixie's cloud usage report enrichment service, this is the same bucket you will connect later, so a name that includes your company or team is recommended, for example `abc-billing-data`. See [Connect Google Cloud Storage](/guides/connect-data/gcp).

Check the following before you begin:

* Whether the detailed export is already enabled. Look for a table named `gcp_billing_export_resource_v1_*` in an existing billing dataset. The standard export table `gcp_billing_export_v1_*` is not sufficient; the resource-level table is required. If it already exists, skip to [Deliver the table to your bucket](#deliver-the-table-to-your-bucket).
* If an organisation policy restricts which identities can be granted IAM roles, known as domain-restricted sharing, pre-approve an exception. Enabling the export adds Google's billing export service account, `billing-export-bigquery@system.gserviceaccount.com`, as a dataset owner, and fails without the exception.
* If VPC Service Controls apply to BigQuery, add the ingress and egress rules covered in [Google's setup guide](https://docs.cloud.google.com/billing/docs/how-to/export-data-bigquery-setup). For the delivery job, the dataset and destination bucket must be in the same perimeter or have an egress rule.

If usage spans more than one billing account, repeat these steps per billing account. Each billing account writes its own table.

## Enable the BigQuery export [#enable-the-bigquery-export]

1. In the Google Cloud console, go to **Billing**, select the billing account, then **Billing export**.
2. On the **BigQuery export** tab, click **Enable [Detailed usage cost](https://docs.cloud.google.com/billing/docs/how-to/export-data-bigquery-tables/detailed-usage) export**.
3. Select the host project and dataset, then save.
4. Confirm the table `gcp_billing_export_resource_v1_<billing_account_id>` appears and receives data. It is partitioned by day. Cost data usually appears within a few hours, and any retroactive backfill for multi-region locations can take up to 5 days.

## Deliver the table to your bucket [#deliver-the-table-to-your-bucket]

5. Create a daily scheduled job that exports the previous day's partition to the bucket. A BigQuery scheduled query using [`EXPORT DATA`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/export-statements) is the simplest option, and a Composer or Workflows job works equally well. Base it on the query below, which writes Parquet with zstd and shards output with a wildcard.

```sql
EXPORT DATA OPTIONS (
  uri = 'gs://<destination-gcs-bucket>/input/gcp/<billing_account_id>/<year_month>/*.parquet',
  format = 'PARQUET',
  compression = 'ZSTD',
  overwrite = true
) AS
SELECT *
FROM `<project>.<dataset>.gcp_billing_export_resource_v1_<billing_account_id>`
WHERE DATE(_PARTITIONTIME) = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY);
```

Adapt paths, scheduling and date handling to your own standards. The query above shows the shape to build from.

6. Run a one-off export of all existing partitions to the bucket to cover history from the enablement date to now.

## Required directory structure [#required-directory-structure]

If you will be using Greenpixie's cloud usage report enrichment service, the delivery path must follow the shape below. Unlike AWS and Azure, Google Cloud writes no default layout to fall back on. The delivery job you author sets the path, so use the Greenpixie structure, as the `EXPORT DATA` query above already does.

#### Customer

```
<bucket_name>/<input|output>/<platform>/<account_id>/<year_month>/{partition files}
```

For this export, use `input` and platform `gcp`, with the billing account ID as `<account_id>`, as the `EXPORT DATA` URI above shows. A resulting path looks like the example below.

```
gs://<destination-gcs-bucket>/input/gcp/<billing_account_id>/2026-07/...
```

#### Partner, enriching multiple customers

If you enrich data on behalf of multiple customers, add an `<org_id>` directory above the platform level, and replace `<year_month>` with a `<timestamp>` directory identifying a single upload, in UTC ISO 8601 basic format, `YYYYMMDDTHHMMSSZ`.

```
<bucket_name>/<input|output>/<org_id>/<platform>/<account_id>/<timestamp>/{partition files}
```

A resulting path looks like the example below.

```
gs://<destination-gcs-bucket>/input/org_12345/gcp/<billing_account_id>/20260722T120000Z/...
```

Adjust the `EXPORT DATA` URI above to match this shape.

Each upload you mark complete is enriched once, in the nightly check between 01:00 and 04:00 UTC. On-demand runs are available on S3 only; see [Partner trigger](/reference/cur-enrichment/partner-trigger).

## Data and format notes [#data-and-format-notes]

Export **all columns** and keep the full detailed-export schema.

The detailed export contains nested RECORD columns, which Parquet preserves. BigQuery cannot export nested data to CSV, so if you need CSV, flatten the columns in the `SELECT`.

If you will be using Greenpixie's cloud usage report enrichment service, Parquet with zstd compression is preferred, and the query above produces exactly that. No single file should exceed 500 MB. A single `EXPORT DATA` file can be up to 1 GB and its size is not fixed, so the `*` wildcard alone will not hold files under 500 MB. To split further, partition the query on an extra column.

## Check the export worked [#check-the-export-worked]

You should have:

* The detailed usage cost table existing and updating daily.
* Daily files delivered to the agreed bucket path, in nested Parquet or flattened CSV.
* Parquet files, with zstd preferred, and no single file larger than 500 MB.
* A one-off backfill covering the enablement date to present.

To remove the export later, disable it under Billing export settings and delete the scheduled job. Nothing else depends on them.

## Next steps [#next-steps]

Once your export is running, you can enrich it with energy, carbon and water metrics in two ways.

- [Connect your data for cloud usage report enrichment](https://greenpixie.com/docs/guides/connect-data): Grant Greenpixie access to your bucket for managed enrichment.
- [Getting started with the Greenpixie API](https://greenpixie.com/docs/guides/getting-started-api): Enrich the data yourself, in your own environment, using the API.