使用 sheet 中的脚本加载表单响应 - 创建仅包含 ID 号的初始表单

Load form responses with script in sheet - Create initial forms with nothing but an ID number

我有一个只有几个字段的简单表单。我需要从电子表格加载数据并创建表单回复。我需要 10,000 个响应,例如序列号 1-10,000 作为唯一条目。其余字段将为空。

var myFormID = 'Put_Form_ID_Here';
var howManyToSubmit = 10;//How many form submissions

function makeResponses(id,howMany) {
  var allQuestionItems,firstQuestion,frm,i,newAnswer,newRezpnz;

  id = id?id:myFormID;//If an id was passed to the function - use it
  if (!id) {return;};//If there is no id to get the Form - quit
  frm = FormApp.openById(id);//Get a reference to the Form
  
  allQuestionItems = frm.getItems();//Get all questions in the Form

  firstQuestion = allQuestionItems[0];
  
  for (i=1;i<howManyToSubmit;i+=1) {
    newRezpnz = frm.createResponse();
    //Logger.log('thisAnswer: ' + thisAnswer)

    newAnswer = firstQuestion.asTextItem().createResponse(i.toString());
    
    newRezpnz.withItemResponse( newAnswer );
    newRezpnz.submit();//submit a new response
  };
};