How to get AI Assist to query a Google Sheet
The instructions below are for desktops and laptops only.
You can connect Google Sheets to AI Assist, allowing your AI agent to pull real-time spreadsheet data into conversations. This feature enables you to look up inventory, confirm bookings, find order details, or retrieve customer records—all without leaving the chat.
Before you start
Make sure you have:
An active, paid AI Assist plan: Growth, Business, or Enterprise.
A Google account with access to the sheet you want to use.
Basic coding knowledge in Google Apps Script and OpenAPI/YAML. If you’re unfamiliar with coding, we recommend getting a developer’s help. For more information, visit our developer portal.
Prepare your Google Sheet
Here are some tips to organize your sheet so it’s easy to search and returns reliable results:
Use a clear header row with descriptive column names.
Add a unique identifier column for direct lookups (for example: SKU, Order ID, or Email).
Maintain a single data type within each column. For example, keep dates in one column and numbers in another to simplify data management.
Avoid merged cells or hidden columns. Instead, keep your data in a tabular format for better accessibility.
Example
Your Google Sheet can contain order details, product descriptions, or general information.
For example:

If your data is in a file, you can easily import it into Google Sheets:
Open Google Sheets and click File > Import.
Select the Upload tab and choose your file, or drag it into the window.
Choose how you want to import the file:
Create new spreadsheet (recommended)
Insert new sheet(s) into the current spreadsheet
Replace spreadsheet or Replace sheet (use with caution)
Click Import data and verify the header row and column types.
Supported file types: .xlsx, .xls, .csv, .tsv, .ods.
Create and deploy a Google Apps Script web app
1. In your Google Sheet, go to Extensions > App Script.

2. The Apps Script console will open in a new tab. Enter a script in Code.gs to describe the methods to query your sheet.
You can start from this sample script: Code.gs on GitHub. The sample searches a specific column (SKU) and is a simple starting point — modify it to match your data and search rules. For more information on customizing the script, click here.

3. Click Deploy > New deployment.

4. Click the gear icon next to Select type and choose Web app.

5. Enter the Description. Set Execute as to Me. This gives your script access to your sheet.
Set Who has access to Anyone. This allows AI Assist to query your sheet using your script.
Then, click Deploy.

5. Copy and save the Web App URL. You’ll need it for your API specifications.
Note: A new URL is generated with each deployment.
Create an OpenAPI specification
AI Assist needs an OpenAPI (YAML or JSON) file that describes how to call your web app.
You may copy the specs in this example. Ensure to:
Replace the servers.urls value with the Web App URL copied from the Apps Script above.
Remove /exec from the end of the URL.
Modify relevant parameters to fit your needs. For more information on customizing the specs, click here.
Use a validator/editor such as Swagger Editor to check your YAML/JSON. Copy and save your raw file’s URL. You’ll need it for the next section.
For example:

This is how it’ll appear on your dashboard:

If you have multiple API integrations, give each one a descriptive name so it’s easy to find.
Add the integration in tawk.to
Note: You’ll need a paid AI Assist plan to perform this integration.

3. Click Add-ons in the top menu.

4. Under AI Assist, click Settings.

5. Select your AI agent.
6. Select Integration/API.

7. Click + Add under Tools.

8. Click Add tool under API.


11. Set Authentication method to No Auth.
12. Click Save.
Test your integration using the widget preview on the right.
Test and refine
Run common and edge-case queries in the dashboard preview.
Use Logger.log() in Apps Script and check the Executions page for errors.
Confirm the OpenAPI schema matches the actual JSON output.
Cache frequent results if responses are slow.
Keep responses consistent (same fields and types) so AI Assist can parse them reliably.
Security notes
Be cautious when handling sensitive information. Only return the fields AI Assist needs and monitor usage for unusual activity.
Rate limits
Consider Google Apps Script quotas and design for retries and backoff.Data protection
Comply with GDPR and other applicable privacy laws when returning personal data.Versioning
When you change your OpenAPI spec, increment a version or update the title so integrations remain clear.
If you have feedback about this article, or if you need more help:
Click the green live chat icon
Schedule a call with us
Visit our community