Export Billing Data to a File

To access a detailed breakdown of your charges, you can export your daily usage and cost estimates automatically to a CSV or JSON file stored in a Google Cloud Storage bucket you specify. You can then access the data via the Cloud Storage API, CLI tool, or Google Cloud Platform Console.

Usage data is labeled with the project number and resource type. You use ACLs on your Cloud Storage bucket to control who can access this data.

Alternatively, you can export detailed data to a Google BigQuery dataset. For more information, see Export billing data to BigQuery.

How to enable billing export to a file

To enable billing export:

  1. If you haven't already created a bucket in Google Cloud Storage, you need to create one. For instructions, see Creating Storage Buckets.
  2. Then to enable billing export, go to the Google Cloud Platform Console.
  3. Open the left side menu and select Billing.
  4. If you have more than one billing account, select Go to linked billing account to manage the current project's billing. To locate a different billing account, select Manage billing accounts.
  5. Click Billing export.
  6. Select File export.
  7. For Bucket name, specify name of the Cloud Storage bucket into which billing reports will be exported. The Google Service Account is granted write access to this bucket.
  8. For Report prefix, specify a prefix for the Cloud Storage object name for the exported reports. The year, month, and day is appended to the prefix.
  9. For Format, select CSV or JSON.
  10. Click Enable billing export.

Contents of the exported billing file

The following table describes the contents of the exported billing JSON or CSV file. JSON metric names are listed first; CSV metric names are shown in parenthesis under the JSON metric names.

Metric Metric Properties
accountId
(Account ID)
Metric Type: string
Description: The billing account ID
Example: 00D11E-FFCCD9-B44BAE
lineItemId
(Line Item)
Metric Type: string
Description: The URI of the specified resource
Example: com.google.cloud/services/compute-engine/ForwardingRuleChargeBase
startTime
(Start Time)
Metric Type: dateTime
Description: The start time of the measured time period
Example: 2015-04-29T00:00:00-07:00
endTime
(End Time)
Metric Type: dateTime
Description: The end time of the measured time period
Example: 2015-04-30T00:00:00-07:00
projectNumber
(Project Number)
Metric Type: integer
Description: The project number
Example: 333809197194
projectId
(Project ID)
Metric Type: string
Description: The ID of the project
Example: my-app-project
projectName
(Project Name)
Metric Type: string
Description: The name of the project
Example: My first app project
projectLabels
(Project Labels)
Metric Type: string
Description: Project labels, returned as key value pairs. For example, if you created labels called cost-center and geo and the project values for those labels were apacand my-cost-center, the metrics returned would be:
JSON:
{"geo":"apac","cost-center":"my-cost-center"}
CSV:
geo:apac;cost-center:my-cost-center
For more information about labels, see the Google Cloud Platform Blog, Using labels to organize Google Cloud Platform resources.
Measurements
measurementId
(Measurement)
Metric Type: string
Description: URI of the specified resource
Example: com.google.cloud/services/compute-engine/ForwardingRuleChargeBase
sum
(Measurement Total Consumption)
Metric Type: integer
Description: The calculated time period
Example: 86400
unit
(Measurement Units)
Metric Type: string
Description: The time period units of measurement
Example: seconds
Credits
creditId
(Credit)
Metric Type: string
Description: The credit ID
Example: 008F74-21254F-7E5A81::3WDRCXQ9AHU4FK-81
amount
(Credit Amount)
Metric Type: decimal
Description: The calculated credit amount
Example: -0.000024
currency
(Credit Currency)
Metric Type: string
Description: The currency code
Example: USD
Cost
amount
(Cost)
Metric Type: decimal
Description: The calculated cost
Example: 0.59904
currency
(Currency)
Metric Type: string
Description: The currency code
Example: USD