Custom action for Google Sheets

Hi

I dont know if you already found the solution or its still pending. There are number of solutions mentioned here, may be they are good for some users. For me i just want to use actiongpt and google sheet directly nothing in between. after long search and reading i found the below solution.

I am writing it here because may be other users like me need help and find this solution helpful. i am mentioning below the details:

Step 1: create your API (OAUTH) from https://console.cloud.google.com/ (you can ask chatgpt how to do it and it will give you the step by step solution)

Step 2: create a new gpt and go to “cerate action” here select "authentication as “OAUTH” and enter the “client id” and “client secret” for Authorization URL use Sign in - Google Accounts
for Token URL use https://oauth2.googleapis.com/token
for scope URL use https://www.googleapis.com/auth/spreadsheets

Step 3: now ask actiongpt or chatgpt to write the schema to use action gpt you can click on the button “Get help from ActionsGPT” it is on right bottom of schema screen. ActionsGPT uses openai 3.0 you can also ask chatgpt to write with the latest one that is openAI 3.1. it shows in the start of every schema

Step 4: once it is written press the back button and in the screen it will show the call back URL:


copy this call back url and go back to google API screen as shown in the image and paste the call back URL

now you are done

Important Note: everytime you open OAUTH and enter key in the chatgpt callback URL will be changed and you have to update it in google API screen

here is the schema i have asked Chatgpt to write (it is reading data, meta data, writing in cell, for mass update i have not tested it yet if the mass update doesnt work give this schema and ask chatgpt to update it for massupdate error:
{
“openapi”: “3.1.0”,
“info”: {
“title”: “Google Sheets API for GPT”,
“version”: “1.0.0”,
“description”: “This API integration allows the GPT to read from and write to Google Sheets using OAuth 2.0 authentication, retrieve spreadsheet metadata, and perform batch updates.”
},
“servers”: [
{
“url”: “https://sheets.googleapis.com/v4
}
],
“paths”: {
“/spreadsheets/{spreadsheetId}/values/{range}”: {
“get”: {
“summary”: “Read Data from a Google Sheet”,
“operationId”: “readGoogleSheet”,
“parameters”: [
{
“name”: “spreadsheetId”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”
}
},
{
“name”: “range”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”
}
}
],
“responses”: {
“200”: {
“description”: “Successful operation”,
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/SheetResponse”
}
}
}
}
}
},
“put”: {
“summary”: “Update Data in a Google Sheet”,
“operationId”: “updateGoogleSheet”,
“parameters”: [
{
“name”: “spreadsheetId”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”
}
},
{
“name”: “range”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”
}
},
{
“name”: “valueInputOption”,
“in”: “query”,
“required”: true,
“schema”: {
“type”: “string”,
“enum”: [“RAW”, “USER_ENTERED”]
}
}
],
“requestBody”: {
“required”: true,
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/SheetValues”
}
}
}
},
“responses”: {
“200”: {
“description”: “Data updated successfully”,
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/SheetResponse”
}
}
}
}
}
}
},
“/spreadsheets/{spreadsheetId}”: {
“get”: {
“summary”: “Get Spreadsheet Details”,
“operationId”: “getSpreadsheet”,
“parameters”: [
{
“name”: “spreadsheetId”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”
}
}
],
“responses”: {
“200”: {
“description”: “Successful operation”,
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/SpreadsheetDetails”
}
}
}
}
}
}
},
“/spreadsheets/{spreadsheetId}:batchUpdate”: {
“post”: {
“summary”: “Batch Update in a Google Sheet”,
“operationId”: “batchUpdateGoogleSheet”,
“parameters”: [
{
“name”: “spreadsheetId”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”
}
}
],
“requestBody”: {
“required”: true,
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/BatchUpdateRequest”
}
}
}
},
“responses”: {
“200”: {
“description”: “Batch update successful”,
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/BatchUpdateResponse”
}
}
}
}
}
}
}
},
“components”: {
“schemas”: {
“SheetResponse”: {
“type”: “object”,
“properties”: {
“spreadsheetId”: {
“type”: “string”
},
“updatedRange”: {
“type”: “string”
},
“updatedRows”: {
“type”: “integer”
},
“updatedColumns”: {
“type”: “integer”
},
“updatedCells”: {
“type”: “integer”
}
}
},
“SheetValues”: {
“type”: “object”,
“properties”: {
“values”: {
“type”: “array”,
“items”: {
“type”: “array”,
“items”: {
“type”: “string”
}
}
},
“majorDimension”: {
“type”: “string”,
“enum”: [“ROWS”, “COLUMNS”]
}
}
},
“SpreadsheetDetails”: {
“type”: “object”,
“properties”: {
“spreadsheetId”: {
“type”: “string”
},
“properties”: {
“type”: “object”,
“properties”: {
“title”: {
“type”: “string”
}
}
},
“sheets”: {
“type”: “array”,
“items”: {
“type”: “object”,
“properties”: {
“properties”: {
“type”: “object”,
“properties”: {
“sheetId”: {
“type”: “integer”
},
“title”: {
“type”: “string”
},
“index”: {
“type”: “integer”
}
}
}
}
}
}
}
},
“BatchUpdateRequest”: {
“type”: “object”,
“properties”: {
“requests”: {
“type”: “array”,
“items”: {
“type”: “object”,
“description”: “A list of update requests to apply to the spreadsheet.”
}
},
“includeSpreadsheetInResponse”: {
“type”: “boolean”,
“description”: “True if the spreadsheet should be returned in the response.”
},
“responseRanges”: {
“type”: “array”,
“items”: {
“type”: “string”
},
“description”: “The ranges to include in the response.”
},
“responseIncludeGridData”: {
“type”: “boolean”,
“description”: “True if grid data should be included in the response.”
}
}
},
“BatchUpdateResponse”: {
“type”: “object”,
“properties”: {
“spreadsheetId”: {
“type”: “string”
},
“updatedRange”: {
“type”: “string”
},
“responses”: {
“type”: “array”,
“items”: {
“type”: “object”,
“description”: “The results of each update request.”
}
}
}
}
}
}
}

If you need further details i dont know how you will contact me but you can post your message here when i will see it will try to guide you

thanks

3 Likes