# HiveSQL for Microsoft Excel

This ste&#x70;*-*&#x62;y-step tutorial will show how to use Microsoft Excel to retrieve data from the HiveSQL database and present your result in a simple but nice pivot chart.

#### Writing a SQL query <a href="#writing-a-sql-query" id="writing-a-sql-query"></a>

Let’s say for example you want to see how many transactions have been issued each month on the blockchain. The SQL query to get such information will be:

```
SELECT
    YEAR(Blocks.timestamp) AS [Year],
    MONTH(Blocks.timestamp) AS [Month],
    COUNT(*) AS [Transactions]
FROM
    Transactions
    INNER JOIN Blocks ON Transactions.block_num = Blocks.block_num
GROUP BY
    YEAR(Blocks.timestamp),
    MONTH(Blocks.timestamp)
```

**Retrieving data with Excel**

*Start Excel, go to the Data tab and select SQL Server as your data source*

<div align="left"><img src="/files/-M_pIGcZzSeIKcHWJlyb" alt=""></div>

*The Data Connection Wizard will be displayed*

<div align="left"><img src="/files/-M_pI3kuQeFtDMrUMIiU" alt=""></div>

*Enter the connection information in the wizard dialog box as shown and click "Next"*

{% hint style="info" %}
*Use your **HiveSQL account** login and password (see* [*Register your HiveSQL account*](/register-your-hivesql-acount.md)*)*
{% endhint %}

<div align="left"><img src="/files/-M_pJl24O8PXUXiSD15S" alt=""></div>

*Select any table (it doesn’t matter at this stage) and click '"Finish" to close the wizard*

<div align="left"><img src="/files/-M_pK0DxqCYTtS-AB9u3" alt=""></div>

*Click on* *"Properties"*

<div align="left"><img src="/files/-MaUZG3GbmgMaQWon2yt" alt=""></div>

*Select the "Definition" tab and* c*heck the "Save Password" checkbox to avoid Excel asking you for credentials each time you connect to the database.*

![](/files/-M_pMzfz6R6OiT8ZfjzN)

*You can safely ignore the warning if your computer is secure*

<div align="left"><img src="/files/-M_pNS0WLUVgzLRXpNzZ" alt=""></div>

*Open the "Command type" dropdown control and select "SQL"*

<div align="left"><img src="/files/-M_pOIE2BijdqlSGoLUN" alt=""></div>

*Paste your SQL query and click* `OK`

![](https://images.hive.blog/0x0/http://i.imgsafe.org/7e1f6d273e.png)\
\&#xNAN;*Select the type of data presentation you want in Excel.*

#### Finalizing the presentation <a href="#finalizing-the-presentation" id="finalizing-the-presentation"></a>

Now that you got all your data, make a nice chart.

<div align="left"><img src="/files/-M_pRIW5ki4CTA-C0zjQ" alt=""></div>

*Organize your data fields in the pivot properties*

![](/files/-M_pRiD9vyso44AgGR8K)

You now have created your report using the blockchain data.


---

# 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.hivesql.io/tutorials/hivesql-for-microsoft-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.
