Back to All

Restfull api with Google script - seach Operation

Hi team Snatchbot ! First il like Your chatbot Platform ,Easy to use and helpfull !!
But I get Issu need help or advise !!
im trying to use Json to return data from google sheet Everything is set correctly the flow and attribute !

On searching in the internet i found this Google script code (Im not Good On Coding) .
this script help me to search Key element in a sheet. if i deploy and test the url it working but i don't know how use it with snatchbot "Json" please Help !!
Thank YOu very much

The Script :
var ss = SpreadsheetApp.openByUrl("Your Spread Sheet URL");
var sheet = ss.getSheetByName("Sheet1");

function doGet(e){
return search(e) ;

function doPost(e){
return search(e) ;

function search(e){
var id =;

var values = sheet.getRange(2, 1, sheet.getLastRow(),sheet.getLastColumn()).getValues();

for(var i = 0;i<values.length; i++){

if(values[i][0] == id ){
  var name = sheet.getRange(i,2).getValue();
  return ContentService.createTextOutput(name).setMimeType(ContentService.MimeType.TEXT);

return ContentService.createTextOutput("Id not found").setMimeType(ContentService.MimeType.TEXT);