function doPost(e) { try { const body = JSON.parse(e.postData.contents); const queryResult = body.queryResult; const outputContexts = queryResult.outputContexts; let productEntity = ''; // ค้นหา context ที่มีชื่อลงท้ายด้วย 'getprice-followup' const getPriceContext = outputContexts.find(context => context.name.endsWith('getprice-followup')); if (getPriceContext && getPriceContext.parameters) { productEntity = getPriceContext.parameters.product_entity; } // ค้นหาข้อมูลใน Google Sheets const sheetName = "ชื่อ Sheet ของคุณ"; // แทนที่ด้วยชื่อ Sheet ที่ถูกต้อง const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName); const data = sheet.getDataRange().getValues(); // ค้นหาแถวที่มี productEntity const row = data.find(row => row[0] ==...
ความคิดเห็น
แสดงความคิดเห็น