Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google sheets doPost(e)功能部分工作_Google Sheets - Fatal编程技术网

Google sheets doPost(e)功能部分工作

Google sheets doPost(e)功能部分工作,google-sheets,Google Sheets,我有这段代码,它假设从外部源获取信息,将消息发送回此源,要求执行所需操作,然后分析此响应,如果响应在文本中有“@”,它将在某个特定单元格中写入“closed”,然后发送确认此操作的消息 最终,它从未奏效。第一条消息已发送,但第二条消息未发送。而且特定的细胞也没有改变 我怎么知道我的问题出在哪里 function doPost(e) { var contents = JSON.parse(e.postData.contents); var text = cont

我有这段代码,它假设从外部源获取信息,将消息发送回此源,要求执行所需操作,然后分析此响应,如果响应在文本中有“@”,它将在某个特定单元格中写入“closed”,然后发送确认此操作的消息

最终,它从未奏效。第一条消息已发送,但第二条消息未发送。而且特定的细胞也没有改变

我怎么知道我的问题出在哪里

 function doPost(e) 
    {
      var contents = JSON.parse(e.postData.contents);
      var text = contents.message.text;
      var id = contents.message.from.id;
      var name = contents.message.from.first_name + " " + 
      contents.message.from.last_name;
      sendText(id, 'Hi ' + name ,' please send your needed action'); //till here, everything works great


      if (/^@/.test(text))
      {
        var ss = SpreadsheetApp.getActiveSpreadsheet();
        var sheet = ss.getSheetByName("ServiceC");
        SpreadsheetApp.setActiveSheet(sheet);
        var getCallID = text.slice(1).split(" ")[0];
        getCallID = parseInt(getCallID,10);
        var cellToEdit = 'K' + (getCallID + 8) ;
        sheet.getRange(cellToEdit).setValue("close");
        sendText(id, 'now its closed');
      }

好的,我明白了!文本切片是错误的。我把它修好了,它工作得很好