# Google Workspace

To hat-gate read, comment, or write access to specific Google documents, sheets, or slides, you will need to complete the following steps:

1. **Create a** [**Guild**](https://docs.hatsprotocol.xyz/hats-integrations/permissions-and-authorities/discord/guild.xyz-greater-than-discord) **role** associated with access to the Google Workspace document or use an existing Guild role
2. **Associate that Guild role with one or more Hats**
3. **Give that Guild role access** to the relevant Google document(s)

### **1. Create a new role in Guild or use an existing Guild role**&#x20;

*If you have not yet set up a Guild,* [*follow these instructions*](https://help.guild.xyz/en/articles/6947591-how-to-gate-a-google-file)*.*

Navigate to your existing Guild and select "Add Role". We recommend creating a Guild role with the same name and image as the Hat you want to associated it with.

If you have already created a Guild role that you want to associate with this authority, continue to step 2.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FvPo9pmaaXfOwC8LNCI9o%2FScreenshot%202023-07-21%20at%201.57.11%20PM.png?alt=media&#x26;token=1f1ef750-5127-4b96-8b6e-1440c01b9bda" alt=""><figcaption></figcaption></figure>

### **2. Add a requirement that an address must hold a specific Hat token ID in order to claim that Guild role:**&#x20;

*If you have already associated that Guild role with the Hat token ID, you can skip this step.*

Within that Guild role, select "Add Requirement"

<div align="left"><figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FlhTmrW6u6fhyE10539Kt%2FGuild%20%22add%20requirement%22.png?alt=media&#x26;token=cdcb723a-be01-4900-afd8-38ddd7e49689" alt="" width="375"><figcaption></figcaption></figure></div>

Then select "NFT"

![](https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FpsCYSFpYmPoP834UoKoB%2FGuild%20%22select%20NFT%22.png?alt=media\&token=fefa1f30-2ff5-4907-a2c2-af0eb2ae86aa)

Next, input the chain your hat is on, add the Hats Protocol contract address, select "Custom ID" under Requirement type, and enter the custom token ID associated with the hat. *See* [#hats-protocol-contract-addresses-and-token-ids](https://docs.hatsprotocol.xyz/hats-integrations/permissions-and-authorities/..#hats-protocol-contract-addresses-and-token-ids "mention") *for details on how to find the Hats Protocol contract address and specific hat token IDs*.

![](https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FSBpW76w5BL4Sm8nergQj%2FGuild%20%22add%20NFT%20requirement%22.png?alt=media\&token=b1a4e929-83f3-4206-ace2-c30485d0d3aa)

Finally, select "Add requirement".&#x20;

This Guild role is now gated by the hat!

### **3. Give that Guild role access to the relevant Google document(s)**

Within the Guild role, select "Add Reward", select "Google Workspace", and follow the instructions to provide Guild with editor access to the appropriate Google document.&#x20;

Return to Guild, and wait a few seconds for the box below to appear. Once it does, select **Gate File** and then select the desired **access type.** Save by clicking **Gate file** again, and finally click **Save** once more to save the changes to the Guild role.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2Fkto0ekaLP6VOVRoGYywM%2FScreenshot%202023-06-29%20at%205.37.28%20PM.png?alt=media&#x26;token=38f3ff06-7358-4c23-b69c-4c18b642eacb" alt=""><figcaption></figcaption></figure>

That's it, you've now given specific hats special access to a Google Workspace document!&#x20;

### 4. Update your Hats tree to automatically include Guild authorities

This step will enable the Hats app to automatically detect and display Guild.xyz related authorities in your Hats tree:

{% hint style="info" %}
Skip this step if your tree's top-hat already includes the relevant Guild(s).
{% endhint %}

* Select "Edit Tree"
* Locate and select the tree's top-hat
* In the "Hat Basics" section, add the relevant Guilds. A Guild's name can be found in its URL. For example, if the Guild page is <https://guild.xyz/hats-protocol>, then its name is 'hats-protocol'.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2F0fwyNbhRKOOfalPIBjf3%2FScreenshot%202024-04-10%20at%2011.09.17.png?alt=media&#x26;token=7ae78aca-fdba-4dce-a85f-6159c0fb77c5" alt=""><figcaption></figcaption></figure>

Guild.xyz authorities will now be displayed on the relevant hats:

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FdQCkHdOWbNX4GxRYv71e%2FScreenshot%202024-04-10%20at%2011.58.09.png?alt=media&#x26;token=7a18df72-1814-4842-a64c-6b1a39613abb" alt="" width="563"><figcaption></figcaption></figure>


---

# 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.hatsprotocol.xyz/hats-integrations/permissions-and-authorities/google-workspace.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.
