Google 表单编辑 link 不提交现有值,仅提交使用 google 脚本时更改的值?

Google forms edit link does not submit existing values, only those that are changed when using google script?

我有一个 google 表格 link 到 google sheet。在提交表单时,回复会自动填写一个文档模板并生成一个 pdf 文件,并将其保存在驱动器上。我还有一个脚本,如果他们想要更改信息,该脚本会为表单提交填充一个编辑 link 的列。初次提交时一切正常,但在编辑表单时,提交时仅提交已更改的信息,因此大部分信息未定义。

有什么想法吗?

我这样收集表单数据:

function generateQuote(e) { 
//collect form responses and store in variables
  var QuoteID = Utilities.formatDate(new Date(), "CDT", "yyMMddHHss");
  var CustomerName = e.namedValues['Name of Power Plant'][0] !=''? e.namedValues['Name of Power Plant'][0] : ' ';
  var CustomerAddress = e.namedValues['Address'][0] !=''? e.namedValues['Address'][0] : ' ';
}

获取表单编辑期间未更改的所有其他值。

我有一个记录表,其中保存了 onFormSubmit 函数的一些数据。它看起来像这样:

将所有编辑与给定表单提交相关联的一条数据是最后一列,它是表单响应 4 Sheet 中第一个表单条目的行号,这是我的表单用于此代码,行号来自 e.range.rowStart;

这是 onFormSubmit 函数:

function testFormSubmission(ev) {
  var ss=SpreadsheetApp.getActive();
  var sh=ss.getSheetByName('LogSheet');
  var tA=ev.values;//from the event object
  tA=tA.concat([ev.range.rowStart]);//from the event Object
  sh.appendRow(tA);//The ev.values will be replaced in a moment but the ev.range.rowStart will remain on the line allowing you to always know which entry on the Form Response Sheet is being edited
  var lr=sh.getLastRow();
  if(sh.getRange(lr,2).isBlank() || sh.getRange(lr,3).isBlank() || sh.getRange(lr,4).isBlank()) {//if any of these are blank then I assume that this is an edit.  Unfortunately, it could also be a spurious trigger.  But we haven't seen those for a while so I assumed that they are response edits.
    var vA=ev.range.getSheet().getDataRange().getValues();//These are all of the values on the Form Responses 4 sheet
    tA=[vA[ev.range.rowStart-1]];//Since I used getDataRange() and start from 1 to skip the header then I know that the correct array index is row number - 1 so that gets me the row contents of Form Responses 4 Sheet.
    sh.getRange(lr,1,1,tA[0].length).setValues(tA);//Using set values I copied that data into the last row of the logSheet into the line which I just appended thus providing all of the responses including the edited response.
  }
}