> For the complete documentation index, see [llms.txt](https://university.mindstudio.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://university.mindstudio.ai/building-ai-agents/blocks-reference/fetch-google-doc.md).

# Fetch Google Doc

## Configuration

### Account&#x20;

#### Dynamic (Ask at runtime)

This setting will ask a user to login to their Google Drive account when they run the app.

#### Connect a New Account

Follow the instructions on the pop-up window to directly connect MindStudio to your Google Drive account.&#x20;

### Document&#x20;

Select the Google Doc you want to fetch. If you have connected your Google Drive account, you can search for your document by selecting the **Choose Document** button.

### Export Format

Select the format you want the document contents exported as. Options include:

* **Plain Text**&#x20;
* **Markdown**&#x20;
* **HTML**
* **JSON (Google Doc Format)**

### Output Variable&#x20;

Save the contents of the fetched document to a variable. Example: `Doc_fetch_1`

## Sample Output - JSON

```json
{
  "title": "Document Title",
  "body": {
    "content": [
      {
        "startIndex": 24,
        "endIndex": 54,
        "paragraph": {
          "elements": [
            {
              "startIndex": 24,
              "endIndex": 32,
              "textRun": {
                "content": "Invited "
              }
            },
            {
              "startIndex": 32,
              "endIndex": 33,
              "person": {
                "personProperties": {
                  "name": "John Doe",
                  "email": "example@example.com"
                }
              }
            },
            {
              "startIndex": 33,
              "endIndex": 34,
              "textRun": {
                "content": " "
              }
            },
            {
              "startIndex": 34,
              "endIndex": 35,
              "person": {
                "personProperties": {
                  "name": "John Doe",
                  "email": "example@example.com"
                }
              }
            }
          ]
        }
      },
      {
        "startIndex": 97,
        "endIndex": 641,
        "paragraph": {
          "elements": [
            {
              "startIndex": 98,
              "endIndex": 641,
              "textRun": {
                "content": "Text content."
              }
            }
          ]
        }
      }
    ]
  }
}
```

This block can also output the selected Google Doc content in **plain text**, **Markdown** or **HTML** format.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://university.mindstudio.ai/building-ai-agents/blocks-reference/fetch-google-doc.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.
