缺席)参数列表后。 (第6行文件"代码")

时间:2014-10-27 15:19:29

标签: javascript google-chrome

我是编码的新手,并且在电子表格中使用这个预先设定的代码用于google awesome table,我一直收到此错误。

  

缺少)参数列表后。 (第6行,文件“代码”

这是我的代码:

var formURL = 'https://docs.google.com/a/waitrose.co.uk/forms/d/11-z44oW1ixP1tShkwjrBpa0DptOA2IinU5MCCkUvf0o/viewform';
var sheetName = 'Form responses 1';
var columnIndex = 5;

function getEditResponseUrls(){
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(Form responses 1);
  var data = sheet.getDataRange().getValues();
  var form = FormApp.openByUrl(formURL);
  for(var i = 2; i < data.length; i++) {
    if(data[i][0] != '' && (data[i][columnIndex-1] == '' || !data[i][columnIndex-1])) {
      var timestamp = data[i][0];
      var formSubmitted = form.getResponses(timestamp);
      if(formSubmitted.length < 1) continue;
      var editResponseUrl = formSubmitted[0].getEditResponseUrl();
      sheet.getRange(i+1, columnIndex).setValue('<div style="width:100px"><a href="' + editResponseUrl + '" target="_blank">Edit entry</a></div>'); 
    }
  }
}

1 个答案:

答案 0 :(得分:1)

看起来你在第6行缺少一对引号:

var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(Form responses 1);

应该是

var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Form responses 1");