# Retrieve and save real-time data to Google Sheet

## Create and download Google JSON service account key

Access Google Cloud Console: <https://console.cloud.google.com/>

Select or create a new project; if no project exists, click "New Project."

<figure><img src="https://content.gitbook.com/content/h9puEqHZfqYUzc1yRE8w/blobs/5ZiL5W2qXy1y87ouNzHC/image.png" alt=""><figcaption></figcaption></figure>

Access **APIs & Services > Library**

<figure><img src="https://content.gitbook.com/content/h9puEqHZfqYUzc1yRE8w/blobs/6Rcatmd5cncziElZnHFD/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/h9puEqHZfqYUzc1yRE8w/blobs/a3Wszj00SLBbRlDlQuTo/image.png" alt=""><figcaption></figcaption></figure>

Click **Google Sheets API**

<figure><img src="https://content.gitbook.com/content/h9puEqHZfqYUzc1yRE8w/blobs/DiKdvNaUISKPLUCKfwri/image.png" alt=""><figcaption></figcaption></figure>

Enable API

<figure><img src="https://content.gitbook.com/content/h9puEqHZfqYUzc1yRE8w/blobs/ByNNAQlXRUz0z9gy3D4H/image.png" alt=""><figcaption></figcaption></figure>

Access **IAM & Admin > Service Accounts**, click **"Create Service Account"**, perform naming for the Service Account, then click "Create and Continue".

<figure><img src="https://content.gitbook.com/content/h9puEqHZfqYUzc1yRE8w/blobs/g6aaz6mUigvxiya7XpGj/image.png" alt=""><figcaption></figcaption></figure>

Choose a role for Service Account (Editor) and click "Continue".

<figure><img src="https://content.gitbook.com/content/h9puEqHZfqYUzc1yRE8w/blobs/XtewILPjFkYYhiIzUVxU/image.png" alt=""><figcaption></figcaption></figure>

After creating the Service Account, click on the newly created Service Account name, go to the "**Keys**" tab, click "**Add Key**" > "**Create new key**", select **JSON**, and click "**Create**." Your browser will then download the JSON configuration file to automatically access Google Sheets. Next, move the downloaded JSON file to the same folder as your Python file where you write the code to retrieve data from FiinQuant and save it to Google Sheets.


---

# 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.fiinquant.vn/fiinquant-en/practical-application/retrieve-and-save-real-time-data-to-google-sheet.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.
