Back to AI Tools & Custom Tools

How To Use AI To Search Google Sheet For Data To Answer Clients


This guide walks you through creating a read-only API for a Google Sheet and connecting it to an AI agent as a custom tool.


Google Sheet Integration Tutorial


Part 1: Stand Up a Read-Only Google Sheet API


1. Prepare Your Sheet


  1. Create a new Google Sheet or open an existing one
  2. Name the specific tab you want to use (e.g., Products, Services, Inventory)
  3. In the first row, enter your column headers. Make sure they are unique and have no spaces or special characters:

- \id | name | price | description | stock_quantity | permalink\

  1. Fill in the subsequent rows (from row 2 downwards) with your data

2. Write & Deploy an Apps Script Web App


  1. In your Google Sheet, navigate to Extensions → Apps Script
  2. A new script editor will open. Delete any boilerplate code
  3. Paste the following code into the editor:


3. Set the API Secret


  • In the Apps Script editor, click Project Settings (gear icon)
  • Scroll down to Script Properties and click Add script property

- Property: API_SECRET

- Value: Enter a strong, random string (DO NOT INCLUDE ANY SYMBOLS, Alphabet & Numbers Only)

  • Save the script properties

4. Deploy the Web App


  1. Click Deploy → New deployment
  2. Select Web app as the type
  3. Set Execute as: Me
  4. Set Who has access: Anyone
  5. Click Deploy and authorize the app
  6. Copy the Web App URL - this is your API endpoint



Part 2: Configure the Custom Tool in ABC Sales AI


  1. In your ABC Sales AI dashboard, go to AI Agents → AI Tools
  2. Click Add Tool and select Custom Tool
  3. Configure the tool:

- Tool Name: search_sheet

- Description: Searches for products/data and returns matching results

- Method: GET

- URL: Paste your Apps Script URL with \?secret=YOUR_API_SECRET&search=\


  1. Add the parameter:

- Name: search

- Type: String

- Location: Query

- Required: Yes


  1. Save the tool and add it to your AI Agent

💡
Pro Tip: Test your API by visiting the URL in your browser with a search term. You should see JSON results.

Still need help?

Our support team is ready to assist you.

Contact Support