Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.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
Javascript TypeError:在对象范围中找不到函数setvalue_Javascript_Api_Google Apps Script_Google Sheets_Setvalue - Fatal编程技术网

Javascript TypeError:在对象范围中找不到函数setvalue

Javascript TypeError:在对象范围中找不到函数setvalue,javascript,api,google-apps-script,google-sheets,setvalue,Javascript,Api,Google Apps Script,Google Sheets,Setvalue,我有一个脚本,它从google sheet中选取最后更新的行,并通过外部API成功地将其发布到项目的系统中 现在,我添加了几行代码,以便它在从中拾取数据的行的最后一个单元格上更新fetch success或failure,但我一直在获取,在对象范围中找不到函数集值。我对javascript非常陌生,因此,我将感谢您的帮助 这是不带auth密钥的代码 function lastRowData(){ var ss = SpreadsheetApp.getActive() var sheet =

我有一个脚本,它从google sheet中选取最后更新的行,并通过外部API成功地将其发布到项目的系统中

现在,我添加了几行代码,以便它在从中拾取数据的行的最后一个单元格上更新fetch success或failure,但我一直在获取,在对象范围中找不到函数集值。我对javascript非常陌生,因此,我将感谢您的帮助

这是不带auth密钥的代码

function lastRowData(){
 var ss = SpreadsheetApp.getActive()
 var sheet = ss.getActiveSheet()
 var lastRow = sheet.getLastRow() 
 var lastCol = sheet.getLastColumn()
 var lastRowData = sheet.getRange(lastRow,1,1,lastCol).getValues()
 return lastRowData[0]
}
function myFunction() {
var lastRow = lastRowData()
var data = {

    'name':lastRow[2],
    'client': lastRow[3],
    'starts_at':lastRow[5],
    'ends_at':lastRow[6],
    'project_state':lastRow[4],
};
    var payload = JSON.stringify(data);

    var options = {
        'method': 'POST',
        'Content-Type': 'application/json',
        'payload': payload,
        'muteHttpExceptions': true
    };
        var url = 'https://api.10000ft.com/api/v1/projects?auth=**token**';
       enter code here var response = UrlFetchApp.fetch(url, options);
        var ss = SpreadsheetApp.getActive();
        var sheet = ss.getActiveSheet();
        if (response.getResponseCode() === 200) { 
        sheet.getRange("X1").setvalue("Yes");
    }
    else {
        sheet.getRange("X1").setvalue("No");
    }
}

使用
.setValue()
而不是
.setValue()

使用
.setValue()
而不是
.setValue()
,大小写很重要。谢谢@ZektorH