Learn how to connect ChatGPT with Google Sheets using a Custom GPT. Get stock data, sales reports in real time 🙌
[
Google Sheets AppScript
](https://www.dropbox.com/scl/fi/5uve4t0zubndmjq7ci4gw/Google-Sheets-to-GPT.js?rlkey=rr6ifmm7aieu68wrzbu49jnov&dl=0)
[
Custom GPT Schema
](https://www.dropbox.com/scl/fi/s2djbj6uiu08qx0xozamd/Schema-GPT.json?rlkey=o5xckuyvhlqgqy0bwi6tb0abe&dl=0)
By linking Google Sheets with ChatGPT via a Custom GPT, you can:
Your Google Sheet fundamentally can have as much data in it as you’d like!
Stock Tickers – You can use google’s inbuilt ‘Finance’ function to query a stock ticker (e.g =GOOGLEFINANCE(“GOOG”,”price”)).
Sales Data – Build out the spreadsheet as much as you want, pull in live data from your sales software.
Output – We are then going to output this data as ‘JSON’ which is a really easy format for our custom GPT to hook on to. You may need to customise the AppScript and Schema I’ve provided above – depending on your setup. Remember – ChatGPT is your friend here if you are no code.
Our Example Sheet – Our example sheet and AppScript outputs the data from cell B13 in the sheet name ‘Example’. Providing you understand this, you can customise the sheet and script as you please!
When working with Google Sheets, we need to access specific data from a sheet and retrieve it in real-time for use in other applications. By using Google Apps Script, we can create a simple API endpoint that returns spreadsheet data in JSON format, allowing easy integration with our CustomGPT tool.
The function doGet(e) creates a public API endpoint that allows us to retrieve a specific cell’s value from a Google Sheet.
"Example" as the sheet name and "B13" as the cell to retrieve.B13.Copy the code – Copy the below code and click on ‘AppScript’ in your google sheets file.
Edit the Sheet Name & Cell – If required.
Deploy the App – As a new web app. Go through the authorisation process and copy the url you are provided after deployment.
``function doGet(e) { // Specify the name of the sheet and the cell to retrieve const sheetName = "Example"; const cell = "B13"; try { // Open the active spreadsheet const spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); const sheet = spreadsheet.getSheetByName(sheetName); // Check if the sheet exists if (!sheet) { return ContentService.createTextOutput(JSON.stringify({ status: "error", message: `Sheet named "${sheetName}" not found.` })).setMimeType(ContentService.MimeType.JSON); } // Get the value from the specified cell const cellValue = sheet.getRange(cell).getValue(); // Return the value as a JSON response return ContentService.createTextOutput(JSON.stringify({ status: "success", value: cellValue })).setMimeType(ContentService.MimeType.JSON); } catch (error) { // Handle any errors return ContentService.createTextOutput(JSON.stringify({ status: "error", message: error.message })).setMimeType(ContentService.MimeType.JSON); } }``
Now that you have set up your Google Sheets API endpoint, it’s time to create a Custom GPT that can retrieve and analyse data from your spreadsheet in real-time! This step will guide you through setting up your own ChatGPT instance that can fetch live data directly from Google Sheets.
To begin, navigate to the Custom GPT Editor:
➡️ Visit the ChatGPT GPTs Editor
Here, you will build the foundation of your GPT by customising its name, instructions, and conversation starters.
In the editor, follow these steps:
Now, you need to integrate your GPT with your Google Sheets webhook by creating a new Custom Action.
Once the action is added, you should see “getcellvalue” as an available option.
Press the Test button.
Click Allow when prompted.
Your GPT should now fetch the value from your Google Sheet and display it.
`{ "openapi": "3.1.0", "info": { "title": "Google Sheets Data Fetcher", "version": "1.0.0", "description": "Fetches the value of a specific cell from a Google Sheet using a Google Apps Script macro." }, "servers": [ { "url": "insert_your_google_sheets_macro" } ], "paths": { "/exec": { "get": { "summary": "Fetch the value of a specific cell from a Google Sheet", "operationId": "getCellValue", "parameters": [ { "name": "sheet_name", "in": "query", "required": true, "description": "The name of the sheet to fetch the data from.", "schema": { "type": "string" } }, { "name": "cell", "in": "query", "required": true, "description": "The address of the cell to fetch the data from (e.g., B13).", "schema": { "type": "string" } } ], "responses": { "200": { "description": "A JSON object containing the value of the requested cell.", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "description": "The status of the request ('success' or 'error')." }, "value": { "type": "string", "description": "The value of the requested cell (if the status is 'success')." }, "message": { "type": "string", "description": "An error message (if the status is 'error')." } }, "required": [ "status" ] } } } } } } } } }`
One of my investments in Touchstone Exploration. You can find a custom GPT I’ve built for TXP here.
I’ve uploaded all of the Regulatory News Services for TXP in it’s memory, as well as connecting it to live data such as the share price, shares in issue and more.
Congratulations! You’ve successfully created a Custom GPT that can fetch real-time data from Google Sheets. With this setup, you can now:
By leveraging Google Apps Script, and ChatGPT actions, you’ve built a dynamic system that makes data more accessible, interactive, and intelligent. The possibilities for automation, data processing, and AI-powered decision-making are endless!
💡 What’s next? You can further refine your Custom GPT by adding more actions, integrating additional data sources, or expanding its analytical capabilities.
🚀 Ready to take it even further? Keep experimenting, refining, and unlocking new AI-powered workflows.
Happy Custom GPTing! 🎉
Last updated
Category
AIViews
1,237 viewsLikes
More posts
Software engineers and AI: more output, not more value? A recent Reddit thread from a distinguished engineer in an AWS vertical struck a nerve. The claim is simple: AI has clearly increased visible activity – more documents, more code commits, more test harnesses – but not the value that users actually feel. “I see a [...]
JoshuaJuly 5, 2026
The AI adoption gap is real: what a blunt Reddit post gets right A recent Reddit thread tells a familiar story. A marketing-tech founder demos “AI agents” to a senior stakeholder at a big brand. The exec is sceptical, calls them “wrappers”, then asks for help setting up a WhatsApp broadcast channel. The punchline isn’t [...]
JoshuaJuly 5, 2026
Making a 3D RPG with AI only: what was built and why it matters A Redditor has shared an ambitious “AI-only” game dev experiment: a third-person 3D RPG prototype created without writing code, driven entirely by prompts to the muranyi-3 model from Tesana AI. You can read the full thread here: Making a RPG game [...]
JoshuaJuly 5, 2026
No ratings yet
No comments yet - start the conversation.