Google apps script 谷歌表单,防止重复或覆盖联系人

Google apps script 谷歌表单,防止重复或覆盖联系人,google-apps-script,google-sheets,google-forms,google-sheets-macros,Google Apps Script,Google Sheets,Google Forms,Google Sheets Macros,请原谅我的英语。 我是一个新用户,我对编程语言不是很了解!:-) 我需要你宝贵的帮助。 我正在处理一个谷歌表单,我必须注册客户来选择他们的生日礼物 在写作之前,我在这里读了很多关于这个主题的帖子,但我没有找到解决问题的方法。最接近的是: 我试着运行我找到的脚本,但当我运行它们时,会出现以下问题: TypeError:无法调用null的“getSheetByName”方法。(第16行,文件“UPDATEcontact”) 图纸名称为:compleanno2020 function updateEx

请原谅我的英语。 我是一个新用户,我对编程语言不是很了解!:-)

我需要你宝贵的帮助。 我正在处理一个谷歌表单,我必须注册客户来选择他们的生日礼物

在写作之前,我在这里读了很多关于这个主题的帖子,但我没有找到解决问题的方法。最接近的是:

我试着运行我找到的脚本,但当我运行它们时,会出现以下问题: TypeError:无法调用null的“getSheetByName”方法。(第16行,文件“UPDATEcontact”)

图纸名称为:compleanno2020

function updateExisting(columnWithUniqueIdentifier,sheetTabName) {
  var dataFromColumnToMatch,lastColumn,lastRow,rowWithExistingUniqueValue,rowOfDataJustSaved,
      sh,ss,valueToSearchFor;

  // USER SETTINGS - if the values where not passed in to the function
  if (!columnWithUniqueIdentifier) {//If you are not passing in the column number
    columnWithUniqueIdentifier = 2;//Hard code column number if you want
  }

  if (!sheetTabName) {//The sheet tab name was not passed in to the function
    sheetTabName = "compleanno2020";//Hard code if needed
  }
  //end of user settings

  ss = SpreadsheetApp.getActiveSpreadsheet();//Get the active spreadsheet - this code must be in a project bound to spreadsheet
  sh = ss.getSheetByName(sheetTabName);

  lastRow = sh.getLastRow();
  lastColumn = sh.getLastColumn();

  //Logger.log('lastRow: ' + lastRow)

  rowOfDataJustSaved = sh.getRange(lastRow, 1, 1, lastColumn).getValues();//Get the values that were just saved

  valueToSearchFor = rowOfDataJustSaved[0][columnWithUniqueIdentifier-1];
  //Logger.log('valueToSearchFor: ' + valueToSearchFor)

  dataFromColumnToMatch = sh.getRange(1, columnWithUniqueIdentifier, lastRow-1, 1).getValues();
  dataFromColumnToMatch = dataFromColumnToMatch.toString().split(",");
  //Logger.log('dataFromColumnToMatch: ' + dataFromColumnToMatch)

  rowWithExistingUniqueValue = dataFromColumnToMatch.indexOf(valueToSearchFor);
  //Logger.log('rowWithExistingUniqueValue: ' + rowWithExistingUniqueValue)

  if (rowWithExistingUniqueValue === -1) {//There is no existing data with the unique identifier
    return;
  }

  sh.getRange(rowWithExistingUniqueValue + 1, 1, 1, rowOfDataJustSaved[0].length).setValues(rowOfDataJustSaved);
  sh.deleteRow(lastRow);//delete the row that was at then end
}
我应该怎么做: 我想让客户只注册一次-不激活登录-或者如果不可能,我想覆盖重复的数据

要检查的变量肯定是电子邮件地址,但如果可能的话,应该有一个双重检查,或与生日相关的电子邮件地址。 下面我附上我的样品表

你有什么解决办法吗? 我真的希望如此。。。我提前向你们表示感谢


谢谢大家。

所以我相信你们是说,我们有一个谷歌表单,客户可以用它来选择生日礼物,你们希望阻止他们提交生成相同电子邮件的表单。不幸的是,对于提交的内容,您无能为力。但是你可以从最终列表中删除重复项。如果你向我提供一份链接表样本,那么我可以告诉你如何完成。注意:我不想要图像。我想要一个样本表,我可以从中复制数据进行测试。事实上,我正在查看谷歌表单工具,我想如果您可以要求登录(即他们必须有谷歌电子邮件帐户),那么您可以将他们限制为1个回复。首先,感谢您的回复。我感谢你的建议,如何删除重复从表我知道如何做。。。我想要的是,当您单击模块的send按钮时,它会通过脚本自动完成。我想知道联系人是否已经存在(电子邮件)或被覆盖或无法重新注册。PS:我不明白为什么我在这个网站上找到的脚本不适合我。TypeError:无法调用null的“getSheetByName”方法。(第16行,文件“UPDATEcontact”)使用谷歌的access对我来说是不可能的。我们谈论的是12000个联系人,我不能期望每个人都在谷歌上注册。