格式 google 表格答案是文本而不是数字?

Format google Form answer to be text instead of number?

我有一个按照以下结构工作的编号系统:000A00(前三位数字代表一年中的第几天,“A”代表年份字母(我目前在“E”年) 最后两位代表产品的修订号。

此数字以 google 形式作为答案提交。但是,我们 运行 遇到了当前年份字母为“E”的问题...因为现在不是将答案视为文本(如我所愿),而是将其视为带有科学记数法的数字。 因此,例如,它不是 015E01,而是转换为 1.50E+02,这就是响应中显示的内容 sheet。 关于如何 让它显示为原文??

我试过更改相应列的格式。如果您将格式更改为纯文本,然后在 Sheet 上输入文本,那么它将保持为文本。但是,当发生表单提交时,似乎插入了一行并且没有采用列的格式。事后更改格式似乎也无法将其恢复为原始文本。

欢迎提出建议,包括解决问题的脚本。但是,请记住,我正在 运行 设置几百个这样的表格,每个表格都有一些问题需要这种类型的回答结构以及问题的数量和问题编号(以及表格中的相应列)响应 sheets) 每种形式的变化。

这显然只是一个问题,现在年份字母为“E”,我有数百个前几年的条目都运行良好。

我能够复制您的问题并创建一个脚本,可能会为您指明正确的方向。看我的example form here and the corresponding spreadsheet here。突出显示的列显示了从表单发送的修改后的响应值(您可以通过发送虚假条目来进行测试)。

它所做的只是将表单响应值获取到特定项目(作为文本),然后将其作为文本公式插入,例如 ="015E01".

这是我使用的代码,其中包括更新所有条目,以及如果您想尝试调整追溯成员。确保在 header.

中使用适当的电子表格 ID 和常量更新您的代码
const thisForm = FormApp.getActiveForm();
const theQuestion = thisForm.getItemById(21944463) //<--- change this to your question number
const ss = SpreadsheetApp.openById(thisForm.getDestinationId()).getActiveSheet();
//runs on submissiong
  //Make sure to enable as a trigger
  function onEntry(e) {
    addTextValue(e.response);
  }

//fixes all responses
function fixAllValues() {
const entryPoint = "E2"; //set where you want to insert new values
var theCollectedReplies = [];
var allReplies = thisForm.getResponses();
for (var i = 0; i < allReplies.length; i++) {

  var theValue = allReplies[i].getResponseForItem(theQuestion).getResponse();
  theCollectedReplies.push(['"' + theValue + '"']);
}
ss.getRange(ss.getRange(entryPoint).getRow(), ss.getRange(entryPoint).getColumn(), 
  theCollectedReplies.length, 1).setFormulasR1C1(theCollectedReplies);
}


//Add values when resposnses are submited
  function addTextValue(theResponse) {
    const theColumnOfData = 4 //where to put new entry
    var theValue = theResponse.getResponseForItem(theQuestion).getResponse();

    ss.getRange(ss.getLastRow(), theColumnOfData).setFormulaR1C1('"' + theValue + '"');
  }