# Excel

Pull Koinju market data straight into Microsoft Excel using either the ClickHouse ODBC driver or Excel's built-in Power Query connector.

## Before you start

| Setting       | Value                     |
| ------------- | ------------------------- |
| Host          | the provided database URL |
| Port          | 8443                      |
| Protocol      | HTTPS / SSL enabled       |
| Database      | api                       |
| User/Password | provided by Koinju        |

Don't have credentials yet? See [How to connect](/how-to-connect.md).

## Step-by-step

### Option A — ODBC driver

1. Download the Windows ODBC driver MSI from the [ClickHouse ODBC releases page](https://github.com/ClickHouse/clickhouse-odbc/releases) and install it.
2. Open **ODBC Data Sources** (Windows) and create a new **DSN** for the ClickHouse driver:
   * **Host**: the provided database URL
   * **Port**: `8443`
   * **SSL**: on
   * **Database**: `api`
3. In Excel: **Data ▸ Get Data ▸ From Other Sources ▸ From ODBC**.
4. Pick the DSN you created, enter the **username** and **password** provided by Koinju.
5. Choose a table (or supply a SQL statement) and **Load**.

### Option B — Power Query connector

1. Make sure the ClickHouse ODBC driver from Option A is installed (the Power Query ClickHouse connector relies on it).
2. In Excel: **Data ▸ Get Data ▸ From Database ▸ ClickHouse**.
3. Enter:
   * **Server / Host**: the provided database URL, port `8443`
   * **SSL**: enabled
   * **Database**: `api`
4. Supply the **username** and **password** provided by Koinju and load the data.

{% hint style="info" %}
The ClickHouse ODBC driver connects over the **HTTP(S) interface on port 8443** — the same endpoint used by every other tool in this section.
{% endhint %}

If timezone-aware datetimes look shifted or misbehave once loaded into a worksheet, see the timezone guidance in [How to connect](/how-to-connect.md).

## First sanity query

When prompted for a SQL statement (Option A's "advanced" entry or a Power Query native query), run:

```sql
SELECT exchange, market, timestamp, price
FROM api.trade
WHERE market LIKE 'BTC%' AND timestamp > toStartOfDay(now())
ORDER BY timestamp DESC LIMIT 20
```

If you get \~20 rows back, you're connected. Next, explore what data is available in [Data](/data/coverage.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.koinju.io/connect-your-tools/excel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
