How to merge multiple function for apps script ?
I Try learn from google but I can’t find solution
help me please, Thank you very munch.
var ss = SpreadsheetApp.openByUrl("Test1");
var ss = SpreadsheetApp.openByUrl("Test2");
var sheet = ss.getSheetByName("Product");
var member = ss.getSheetByName("Member");
function doPost(e) {
var data = JSON.parse(e.postData.contents)
var userMsg = data.originalDetectIntentRequest.payload.data.message.text;
var values = sheet.getRange(2, 3, sheet.getLastRow(), sheet.getLastColumn()).getValues();
for (var i = 0; i < values.length; i++) {
if (values[i][0] == userMsg) {
i = i + 2;
var Product = sheet.getRange(i, 3).getValue(); //Product
var Data1 = sheet.getRange(i, 4).getValue(); //Price
var Data2 = sheet.getRange(i, 5).getValue(); //Size
var Data3 = sheet.getRange(i, 1).getValue(); //Book Name
var result = {
"fulfillmentMessages": [{
"type": "text",
"text": "Price : " + Data1 + " ฿"
}, ]
}
var replyJSON = ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON);
return replyJSON;
}
}
}
function doPost(e) {
var diaflow = JSON.parse(e.postData.contents)
var userMsg = diaflow.originalDetectIntentRequest.payload.data.message.text;
var valuess = member.getRange(2, 3, member.getLastRow(), member.getLastColumn()).getValues();
for (var i = 0; i < valuess.length; i++) {
if (valuess[i][0] == userMsg) {
i = i + 2;
var Product = member.getRange(i, 3).getValue(); //Product
var Data1 = member.getRange(i, 4).getValue(); //Price
var Data2 = member.getRange(i, 5).getValue(); //Size
var Data3 = member.getRange(i, 1).getValue(); //Book Name
var result = {
"fulfillmentMessages": [{
"type": "text",
"text": "Price : " + Data1 + " ฿"
}, ]
}
var replyJSON = ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON);
return replyJSON;
}
}
}
How to merge multiple function for apps script ?
How to use multiple function because i use this code can run one function only.