> ## Documentation Index
> Fetch the complete documentation index at: https://docs.costory.io/llms.txt
> Use this file to discover all available pages before exploring further.

# BigQuery Data Exports

> Set up BigQuery data exports in Costory so analysts can query dashboard widget data from Looker, notebooks, dbt, and custom SQL.

# BigQuery data exports

**BigQuery data exports** let Copilot Pro organizations query the cost data behind their dashboard widgets from their own BigQuery project. Use them to connect Looker, notebooks, dbt, or custom SQL without rebuilding dashboard filters by hand.

<Info>
  BigQuery data exports are available on Copilot Pro.
</Info>

## How it works

An **Organization Admin** configures access under **Integrations > Destinations**. After access is granted, analysts can copy SQL from any [dashboard](/features/dashboards) widget and run it against the Costory export table in BigQuery.

The copied SQL matches the dashboard widget configuration, including the metric, filters, group-by, and date range.

## Prerequisites

* A Costory organization on Copilot Pro
* **Organization Admin** access in Costory to manage **Integrations > Destinations**
* A BigQuery user or service account that should run the exported queries
* At least one [dashboard widget](/features/dashboards) with the cost view you want to query

## Grant access to the export table

<Steps>
  <Step title="Open Destinations">
    In Costory, go to **Integrations > Destinations**.
  </Step>

  <Step title="Open the BigQuery export destination">
    Select the BigQuery data export destination for your organization.
  </Step>

  <Step title="Grant read access">
    Add the BigQuery user or service account that should query the export table.
  </Step>

  <Step title="Save the destination">
    Save the destination settings. The user or service account can now run copied dashboard queries against the export table.
  </Step>
</Steps>

## Copy SQL from a dashboard widget

<Steps>
  <Step title="Open the dashboard">
    Open the [dashboard](/features/dashboards) that contains the widget you want to analyze outside Costory.
  </Step>

  <Step title="Open widget actions">
    Click the widget action menu.
  </Step>

  <Step title="Copy the query">
    Click **Copy SQL query**.
  </Step>

  <Step title="Run the query">
    Paste the SQL into BigQuery, Looker, a notebook, or another tool that can query BigQuery.
  </Step>
</Steps>

<Frame caption="Copy SQL query from a dashboard widget">
  <img src="https://mintcdn.com/costory/1x7SbT2zUG6hiSyD/images/dashboard/export-to-sql.png?fit=max&auto=format&n=1x7SbT2zUG6hiSyD&q=85&s=9880738ba81e552b692d1208e09bb163" alt="Copy SQL query action on a dashboard widget" width="1651" height="699" data-path="images/dashboard/export-to-sql.png" />
</Frame>

## Permissions

| Permission                               | Who needs it                                | Why                                                            |
| ---------------------------------------- | ------------------------------------------- | -------------------------------------------------------------- |
| Costory **Organization Admin**           | The person configuring the destination      | Required to grant access under **Integrations > Destinations** |
| BigQuery read access to the export table | The user or service account running queries | Required to run copied SQL outside Costory                     |
| Dashboard access in Costory              | The person copying SQL                      | Required to open the widget and copy its query                 |

## FAQ

<AccordionGroup>
  <Accordion title="Does this replace billing data setup?">
    No. BigQuery data exports are for querying Costory data outside Costory. You still need to connect billing data first through [Billing Data](/setup/billing).
  </Accordion>

  <Accordion title="Can I copy SQL from Explorer?">
    The copy action is available on dashboard widgets. To reuse an Explorer query, save it as a dashboard widget first.
  </Accordion>

  <Accordion title="Does the SQL include dashboard filters?">
    Yes. The copied SQL matches the widget configuration, including filters, group-by, metric, and date range.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Dashboards" icon="chart-pie" href="/features/dashboards">
    Build the dashboard widgets you want to query from BigQuery
  </Card>

  <Card title="Billing Data" icon="database" href="/setup/billing">
    Connect cloud billing data before exporting Costory data
  </Card>
</CardGroup>
