# Excel, Google Sheets & Power BI

Every series is available as CSV, so any spreadsheet or BI tool can load it directly and refresh it on a schedule.

The pattern is:

```
https://api.pakdatahub.com/v1/series/<series_id>?format=csv&sort=asc&api_key=<your key>
```

Add `from=YYYY-MM-DD` to limit the window, or `transform=yoy` for growth rates.

## Google Sheets

In any cell:

```
=IMPORTDATA("https://api.pakdatahub.com/v1/series/fx.rate.avg.usd?format=csv&sort=asc&from=2020-01-01&api_key=pk_live_xxx")
```

Sheets refreshes `IMPORTDATA` roughly every hour. The key is visible to anyone the sheet is shared with, so use a separate key for shared sheets and revoke it when you're done.

## Excel (Power Query)

1. **Data -> Get Data -> From Other Sources -> From Web**.
2. Choose **Advanced**. URL: `https://api.pakdatahub.com/v1/series/inflation.cpi.national.yoy?format=csv&sort=asc`.
3. Add an HTTP request header: `X-API-Key` = `pk_live_xxx`. This keeps the key out of the URL.
4. **Load**. Refresh any time with **Data -> Refresh All**.

## Power BI

```powerquery
let
    Source = Csv.Document(
        Web.Contents("https://api.pakdatahub.com/v1/series/rates.kibor.6m",
            [Query = [format = "csv", sort = "asc", limit = "10000"],
             Headers = [#"X-API-Key" = "pk_live_xxx"]]),
        [Delimiter = ",", Encoding = 65001]),
    Promoted = Table.PromoteHeaders(Source)
in
    Promoted
```

## Tips

- Each refresh costs one request per series. Refresh daily, not every minute, since most series update daily or less often.
- The `dims` column holds tags like `{"side":"offer"}`. Filter it in the query (`&dims=side:offer`) rather than in the sheet.
- Ids come from the [catalog](https://pakdatahub.com/coverage) or [`/v1/search`](https://pakdatahub.com/docs/api-search.md).

---
Source: https://pakdatahub.com/docs/use-case-excel-sheets-bi - PakDataHub docs index: https://pakdatahub.com/docs/llms.txt
