Google Sheet Integration
Integrate Google Sheets with MaiAgent using Google Apps Script to call Agents from a spreadsheet and batch-process multiple inputs with a custom function. Includes the complete script and a demo video
This page explains how to use Google Apps Script to integrate MaiAgent’s powerful AI capabilities into Google Sheets. You can call your MaiAgent Chatbot directly from a spreadsheet and batch-process multiple inputs to significantly improve efficiency.
Getting Started
Step 1: Open the Google Apps Script Editor
Open the Google Sheets spreadsheet you want to integrate with MaiAgent, or create a new spreadsheet.
Click “Extensions” > “Apps Script” in the top menu.

Step 2: Paste and Configure the Script
In the Apps Script editor, you will see a file named
Code.gs. Clear its default contents.Copy the complete Apps Script code provided by MaiAgent in the Attachment section below and paste it into
Code.gs.Replace API_KEY and CHATBOT_ID at the beginning of the script.
After making the changes, click the save icon (💾) at the top of the editor to save your script.
Using the MaiAgent Function in Google Sheets
Once you have completed the setup above and granted authorization, you can use the maiagent function in Google Sheets just like a built-in function.
1. Call an Agent Once
Enter a formula in the following format in any cell:
=maiagent("The message you want to send to the Agent")
For example:
=maiagent("Hello, please introduce yourself")=maiagent("The weather is lovely today")
After you press Enter, the script sends your message to the specified Agent and displays the Agent’s response in the cell.
2. Read Message Content from Other Cells
You can have the maiagent function read the contents of other cells as input messages.
If cell A1 contains the message you want to send, enter the following in another cell, such as B1:
=maiagent(A1)
Cell B1 will then display MaiAgent’s response to the contents of A1.
Integration Demo Video
Conclusion
Integrating MaiAgent into Google Sheets through Google Apps Script opens up new possibilities for automation and productivity. Technical users can customize spreadsheets to meet their specific needs and turn them into powerful AI interaction tools for content generation, data analysis, and automated responses.
Attachment
Last updated
Was this helpful?